首页 > 解决方案 > Angular 6:使用 npm start 启动我的应用程序时出错

问题描述

我从事 Angular 6 项目已经有很长时间了,当我node_modules的项目文件夹中有文件夹时,它工作得很好。我希望能够在没有项目node_modules内部的情况下运行我的项目,因此我将node_modules文件夹移动到父文件夹并更改angular.json了以../node_modules. 我认为它会起作用,但是在我写 npm start 之后我得到了这个错误:

pm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! lg-academy@0.0.0 start: `ng serve --configuration=production --host 0.0.0.0 --port 4200 --verbose --disable-host-check`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the lg-academy@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ofir/.npm/_logs/2018-11-15T1

预先感谢所有帮助者

标签: angularnpmdependenciesnode-modulespackage.json

解决方案


在我在这里和谷歌上得到答案并询问了我的一些朋友之后,我刚刚部署了所有内容并将 node_modules 返回到我的项目文件夹。部署它需要很多时间,但没有其他方法。

感谢您的意见和帮助!


推荐阅读