Ionic的环境安装中遇到的坑
Ionic开发环境搭建需要以下几步:
1.下载安装node.js(http://nodejs.org/)
-安装完成后打开windows自带的Power Shell 命令行工具
-输入命令: node.js -v
查看node.js是否安装正确(这一步一般不会出错)
2.使用npm安装 ionic和cordova
-继续命令行输入npm install -g cordova ionic
-这时第一个坑就出现了。因为墙的原因一般下载安装会出错。翻墙也没用。
解决方法:
-连接到淘宝的镜像:npm install -g cnpm registry=https://registry.npm.taobao.org
-然后使用cnpm install -g cordova ionic
安装
-使用命令 ionic -v
以及 cordova -v
查询是否安装好了。
3.创建第一个HybirdApp
-命令ionic start myIonic blank
来创建第一个App项目
-第二个坑出现了
Installing npm packages...
npm WARN deprecated gulp-minify-css@0.3.13: Please use gulp-clean-css
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update t
o graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "ins
tall"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! shasum check failed for C:\Users\lenovo\AppData\Local\Temp\npm-9064-eabb2097\registry.npmjs.org\bower\-\bower-1
.8.0.tgz
npm ERR! Expected: 55dbebef0ad9155382d9e9d3e497c1372345b44a
npm ERR! Actual: 469ffa306f25e8c5ede50608f8776eb6a2aabb7f
npm ERR! From: https://registry.npmjs.org/bower/-/bower-1.8.0.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\lenovo\myIonic\npm-debug.log
Error with start undefined
Error Initializing app: There was an error with the spawned command: npminstall
There was an error with the spawned command: npminstall
解决方法:这个问题还是网络引起的需要再次连接到淘宝镜像
-再次输入ionic start myIonic blank
就OK 了(等的时间比较长)
Your Ionic app is ready to go!
Some helpful tips:
Run your app in the browser (great for initial development):
ionic serve
Run on a device or simulator:
ionic run ios[android,browser]
Test and share your app on device with Ionic View:
http://view.ionic.io
Build better Enterprise apps with expert Ionic support:
http://ionic.io/enterprise