升级ionic版本后,创建新项目报Error Initializing app错误解决

命令行,进入项目路径后,运行

ionic start myApp --v2

命令执行后,报如下错误

Installing npm packages...
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
Caught exception:
undefined

从githut查到是因为node和npm版本低了,解决方法如下

https://github.com/driftyco/ionic-cli/issues/1089

1.升级node

win下直接官网下载最新安装包 https://nodejs.org/en/

OS X 下运行命令

npm install -g n

2.升级npm

upgrade npm

3. 注册表重新注册  set new registry

npm set registry http://registry.npmjs.org

 4. 结果按照上面的步骤执行完之后,

cordova版本也低了,只好继续升级cordova

npm install -g cordova

但是cordova升级报错

从github上面没找到答案,自己试着退出项目路径重新试了一下,结果就成功了……,所以升级和安装什么的,还是得在node的安装路径。

原文地址:https://www.cnblogs.com/viola-sh/p/5629215.html