离子启动给出错误:生成的命令出错:npminstall

时间:2017-03-20 11:45:34

标签: node.js cordova ionic-framework npm

我正在尝试创建一个带有离子和cordova的移动应用程序但是当我启动命令时

ionic start {{appname}} blank 

下载后npm给我

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

我可以看到下载已完成,因为我可以看到生成的文件夹。我按照我在网上找到的所有建议,如更新节点和npm,但没有任何作用。 以下是npm,node,cordova和ionic

的版本
  • ionic 2.2.1
  • cordova 6.5.0
  • npm 4.4.1
  • node 6.10.0

其他小警告: 我不知道为什么在我启动升级后的所有升级

ionic -v

我有这个:

******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************
2.2.1

即使cordova版本是> 4.2.0但我真的不认为这是主要问题。有什么想法吗?

编辑: 我正在使用Windows 7

3 个答案:

答案 0 :(得分:1)

我找到了解决方案! 我试着在午餐时间吃饭

ionic start app blank --verbose

和之前一样,它停在了npminstall。问题是,冗长并没有告诉我真正的问题。 我移动了Ionic下载的文件夹,然后启动

npm install --verbose

在这里,他告诉我问题是https代理配置。 因此,如果Ionic给出的错误只是

There was an error with the spawned command: npminstall

进入下载的文件夹并启动

npm install --verbose 

检查真正的问题

答案 1 :(得分:0)

  1. 卸载所有(离子,cordova,nodejs)。
  2. 使用此网址安装nodejs LTS版本 - https://nodejs.org/en/
  3. 使用此网址安装ionic和cordova - https://ionicframework.com/docs/v2/intro/installation/
  4. 同时重新安装Git,当它询问调整您的PATH环境时,请选择从Windows命令提示符使用Git
  5. 当您以管理员身份安装ionic和cordova open cmd时。
  6. 然后在<html> <head> <title></title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="./js/test.js"></script> <link rel="stylesheet" type="text/css" href="./css/mystyle.css"> </head> <body> <form action="testUIload.jsp" method="post"> <input type="number" id="ChannelNum" name="ChannelNum"> <input type="submit" value="Start Channel"> </form> <% int number = 0; String num = ""; if (request.getParameter("ChannelNum") != null) { num = request.getParameter("ChannelNum"); number = Integer.parseInt(num); for (int i = 0; i < number; i++) { %> <script> $(document).ready( function(){ $("#content_<%=i%>").createComponent( { url : 'RandomDataGen', separator : '|', lableTag : [ 'Channel 1', 'Channel 2', 'Channel 3', 'Channel 4' ], color : 'grey' }); }); </script> <div id="container"> <div class="content" id="content_<%=i%>"></div> </div> <% } } %> </body> </html>
  7. 中运行命令

答案 2 :(得分:0)

我想到了如何解决依赖性警告问题

cordova -v

然后你会得到一个问题:

May Cordova anonymously report usage statistics to improve the tool over time?

说是。然后修正警告问题。 然后全局安装npm

npm install -g npm 

创建应用程序而不安装其软件包

ionic start app --v2 --skip-npm

直到现在好吗?然后

cd app

安装包

npm install --save

完成!尝试启动离子应用程序

ionic serve
相关问题