早上好,来自互联网的人们,
介绍
在遵循Angular2 快速入门指南的过程中,我遇到了很多次lite-server
在执行npm start
. 崩溃在您的终端中看起来像这样:
ERR! Linux 3.19.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "lite"
npm ERR! node v5.7.0
npm ERR! npm
v3.8.2
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 lite: `lite-server`
npm ERR!
Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 lite script 'lite-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 angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR!
Tell the author that this fails on your system:
npm ERR! lite-server
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/oscar/dev/cw/npm-debug.log
最常见的原因(和解决方案)
大多数时候,原因是以下两个之一:
lite-server
没有正确关闭。解决方案:杀死所有 npm / node 实例并重新启动服务器npm start
就可以了。- 依赖项不是最新的。解决方案:只需删除
node_modules
目录,执行npm install
重建依赖关系就可以了。
其他问题
但是,当到达称为6.Routing的步骤时,问题有点不同。这次不是直接崩溃,而是在 typescript 编译后失败:
16.03.15 16:33:49 200 GET /index.html
events.js:154
throw er; // Unhandled 'error' event
^
Error: watch node_modules/angular2/es6/prod/examples/platform/dom/debug/ts/debug_element_view_listener ENOSPC
at exports._errnoException (util.js:856:11)
...
at FSReqWrap.oncomplete (fs.js:82:15)