Angular CLI npm start失败

3

我正在使用angular-cli进行我的第一个angular 2项目,但当我使用npm start命令时,它会生成以下错误:

Running without elevated rights. Running Ember CLI "as Administrator" increases performance significantly.
See ember-cli.com/user-guide/#windows for details.

Livereload failed on http://localhost:49156.  It is either in use or you do not have permission.

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.5.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! ng-app@0.0.0 start: `ng server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-app@0.0.0 start script 'ng server'.
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 ng-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng server
npm ERR! You can get their info via:
npm ERR!     npm owner ls ng-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     ...\ng_app\npm-debug.log

我检查了我的机器上的所有先决条件,因为我有node v5.5.0、typings 1.3.2,但仍然会生成相同的错误。

我错过了什么?

非常感谢!

编辑:今天早上我运行npm start命令时,出现了以下错误:

The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: EPERM: operation not permitted, symlink

2
请查看 https://github.com/angular/angular-cli/issues/1600。 - agriboz
2
你确定端口49156可用吗?你可以尝试访问URL http://localhost:49156 进行检查。 - Nicolas Henneaux
@NicolasHenneaux,它返回{"tinylr":"Welcome","version":"0.2.1"}。 根据@eg16的说法,我以管理员身份运行命令,并且端口4200可用,但是当我在开发工具的控制台中检查时,会出现zone.js:323 Error: Error: XHR error (404 Not Found) loading http://localhost:4200/system-config.js(…)的错误,那么我该如何解决呢? - Radonirina Maminiaina
你可能有另一个进程正在运行。尝试关闭所有其他的ng serve并重新启动一个新的。 - Nicolas Henneaux
谢谢大家,现在它可以工作了!我重启电脑以确保所有进程都停止。 - Radonirina Maminiaina
显示剩余4条评论
1个回答

1

从问题答案来看,这与另一个进程使用端口49156有关,而Angular CLI需要该端口进行自动重新加载。 为确保没有其他程序使用该端口,您可以请求URL http://localhost:49156/。如果找不到该进程,则可以通过重新启动解决问题。


你的意思是什么? - Nicolas Henneaux
这个49156端口不是服务器端口,我认为它是一个测试端口。 - Radonirina Maminiaina
这是用于处理页面重新加载的端口,因此当您修改文件时,CLI会构建并在准备就绪后使用此端口触发浏览器的重新加载。 - Nicolas Henneaux

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接