无法使用npm start启动应用程序

时间:2016-05-19 15:39:53

标签: npm angular

我已按照https://angular.io/guide/quickstart中的说明操作,并使用npm install命令创建了相应的快速入门文件和已安装的依赖项。之后,当我发出 npm start 命令时,我收到以下错误。

npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.25
npm ERR! npm  v3.9.0
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the angular2-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "npm run tsc:w" "npm run lite" 
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/sobin/AngularTuts/heroappbase/npm-debug.log

2 个答案:

答案 0 :(得分:1)

首先,我尝试在命令提示符下运行此命令:

concurrently "npm run tsc:w" "npm run lite"

那很有用。然后,在package.json文件中,我替换了这一行:

"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",

有了这个:

"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",

此时,npm start正常工作。希望有所帮助。

答案 1 :(得分:0)

根据他们的文档,angular2至少需要node 5.x.x

来自site

  

通过在终端/控制台窗口中运行node -v和npm -v,验证您是否至少运行了node v5.x.x和npm 3.x.x.较旧的版本会产生错误。

看起来你正在运行node v0.10.25。尝试升级。

要升级,您可以使用nvm,以便在版本之间轻松切换。 GitHub上的nvm