简体   繁体   English

无法在Angular的示例应用程序中启动Node js服务器

[英]Can't start Node js server in the example application of Angular

I downloaded Angular phonecat example phoject, moved to this directory and tried 'npm start' command. 我下载了Angular phonecat示例项目,移至该目录并尝试了'npm start'命令。 Result: 结果:

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli   '/usr/local/Cellar/nvm/0.17.2/v0.10.32/bin/npm',
1 verbose cli   'start' ]
2 info using npm@2.1.4
3 info using node@v0.10.32
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart angular-phonecat@0.0.0
6 verbose unsafe-perm in lifecycle true
7 info angular-phonecat@0.0.0 Failed to exec prestart script
8 verbose stack Error: angular-phonecat@0.0.0 prestart: `npm install`
8 verbose stack Exit status 3
8 verbose stack     at ChildProcess.<anonymous> (/usr/local/Cellar/nvm/0.17.2/v0.10.32/lib/node_modules/npm/lib/utils/lifecycle.js:212:16)
8 verbose stack     at ChildProcess.emit (events.js:98:17)
8 verbose stack     at maybeClose (child_process.js:756:16)
8 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:823:5)
9 verbose pkgid angular-phonecat@0.0.0
10 verbose cwd /Users/marya/JS:HTML:CSS/angular-phonecat
11 error Darwin 13.4.0
12 error argv "node" "/usr/local/Cellar/nvm/0.17.2/v0.10.32/bin/npm" "start"
13 error node v0.10.32
14 error npm  v2.1.4
15 error code ELIFECYCLE
16 error angular-phonecat@0.0.0 prestart: `npm install`
16 error Exit status 3
17 error Failed at the angular-phonecat@0.0.0 prestart script.
17 error This is most likely a problem with the angular-phonecat package,
17 error not with npm itself.
17 error Tell the author that this fails on your system:
17 error     npm install
17 error You can get their info via:
17 error     npm owner ls angular-phonecat
17 error There is likely additional logging output above.
18 verbose exit [ 1, true ]

I don't understand why but I can't execute server. 我不明白为什么,但是我无法执行服务器。 How can I fix it? 我该如何解决? Thanks in advance. 提前致谢。

It seems node is installed with version node@v0.10.32 似乎节点已安装版本为node@v0.10.32

Anyhow, what really happens is that npm looks in your package.json file, and if you have something like 无论如何,真正发生的是npm在package.json文件中查找,并且如果您有类似

"scripts": { "start": "coffee server.coffee" } }

then it will do that. 然后它将做到这一点。 If npm can't find your start script, it will not work 如果npm找不到您的启动脚本,它将无法正常工作

try node start using 尝试节点开始使用

node <name of your node server>.js

and error seen in your angular-phonecat Try reinstalling it using npm command and try. 和在angular-phonecat看到的错误尝试使用npm命令重新安装并尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM