离子启动时ENOENT错误

时间:2016-03-26 18:03:54

标签: ionic2

我升级到beta.23并在使用' ionic start foo --v2 --verbose'创建新项目时开始出错。
红色的错误说  "无法生成commandError:spawn npm ENOENT(CLI v2.0.0-beta.23)。"

我安装了npm,可以从Windows 8 cmd行运行。 我尝试升级到节点v5.9.1。 我确认npm在PATH环境变量中,可以从cmd shell运行npm。 任何想法如何进一步修复或调试将不胜感激。

这是完整的输出:

   C:\ionic2>ionic start foo --v2 --verbose
   Task setting: title=start, name=start, summary=Starts a new Ionic project in the
    specified PATH, [options]=any flags for the command, <PATH>=directory for the n
    ew project, [template]=Starter templates can either come from a named     template,

   (ex: tabs, sidemenu, blank),
   a Github repo, a Codepen url, or a local directory.
   Codepen url,
Defaults to Ionic "tabs" starter template, --appname|-a=Human readable name     for
the app (Use quotes around the name), --id|-i=Package name for <widget id>     confi
g, ex: com.mycompany.myapp, title=Skip npm package installation,     boolean=true, t
itle=Create a basic structure without Cordova requirements, boolean=true,     title=
   Setup the project to use Sass CSS precompiling, boolean=true, title=List starter
 templates available, boolean=true, --io-app-id=The Ionic.io app ID to use, --te
mplate|-t=Project starter template, boolean=true, title=Start a Ionic v2 project
, boolean=true, title=(with --v2 only) Use TypeScript in starter, --zip-file|-z=
URL to download zipfile for starter template, module=./ionic/start, disableChang
ePwd=true
Utils.preprocessCliOptions _=[start, foo], skip-npm=false, no-cordova=false, w=f
alse, sass=false, s=false, list=false, l=false, v2=true, v=false, typescript=fal
se, -ts=false, verbose=true, $0=C:\Program Files\nodejs\node.exe C:\Users\bradtk
e\AppData\Roaming\npm\node_modules\ionic\bin\ionic

One awesome Ionic app coming right up...

Creating Ionic app in folder C:\ionic2\foo based on tabs project
     Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
     [=============================]  100%  0.0s
     Downloading: https://github.com/driftyco/ionic2-starter-          
       tabs/archive/master.zip
[=============================]  100%  0.0s
Installing npm packages...
Running exec command: npminstall
Utils.fail Unable to run spawn commandError: spawn npm ENOENT undefined
Utils.fail stack undefined
Utils.errorHandler is set, calling that now
Cli.Utils.errorHandler msg Unable to run spawn commandError: spawn npm ENOENT st
ring

Unable to run spawn commandError: spawn npm ENOENT (CLI v2.0.0-beta.23)

Your system information:

Cordova CLI: 6.1.0 (cordova-lib@undefined)
Ionic CLI Version: 2.0.0-beta.23
Ionic App Lib Version: 2.0.0-beta.13
OS: Windows 8.1
Node Version: v5.9.1

此致 布鲁斯

4 个答案:

答案 0 :(得分:13)

我有完全相同的问题。工作在测试版22。

恢复到之前的测试版解决了这个问题:

npm install -g ionic@2.0.0-beta.22

答案 1 :(得分:7)

移至应用程序的文件夹并运行npm install。我不知道发生了什么,但听起来像start脚本试图执行npminstall而不是npm install

Installing npm packages...
Running exec command: npminstall

答案 2 :(得分:0)

这是Windows上CLI的已知问题。降级到cli beta22现在可以作为解决方法,但这将在下一个版本中修复

答案 3 :(得分:0)

升级npm为我工作。 npm install -g npm