[英]Angular-cli - Cannot serve project after updates
I have updated both npm
, node
and angular-cli
to the latest versions. 我已经将
npm
, node
和angular-cli
更新为最新版本。 Now, when I run the ng serve
command in my existing working project, it gives the error below 现在,当我在现有的工作项目中运行
ng serve
命令时,出现以下错误
ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (/home/bunyamin/WebstormProjects/c3dp/node_modules/typescript/lib/typescript.js:8062:20)
at Object.createCompilerHost (/home/bunyamin/WebstormProjects/c3dp/node_modules/typescript/lib/typescript.js:44978:26)
at Object.ngcLoader (/home/bunyamin/WebstormProjects/c3dp/node_modules/@ngtools/webpack/src/loader.js:202:31)
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
I also noticed that when I run npm run start
command, which is ng serve
in the package.json
, it say Environment configuration does not contain "source" entry.
我还注意到,当我运行
npm run start
命令(即package.json
ng serve
时,它说Environment configuration does not contain "source" entry.
which is changed in new version of angular-cli
. 在新版本的
angular-cli
已更改。 I suspect that the npm
does not know about the new version of angular-cli
but is it possible? 我怀疑
npm
不知道angular-cli
的新版本,但是可能吗?
Can anyone who faced this problem before help me to fix it? 之前遇到此问题的任何人都可以帮助我解决此问题吗?
Remove your node_modules
, then run npm cache clean
and after it re-install
them. 删除您的
node_modules
,然后运行npm cache clean
并re-install
它们。 It's all about newLine
error. 全部与
newLine
错误有关。
What about angular-cli
, if you work with newest version ( @angular/cli
), you need also to install it globally 那么
angular-cli
,如果使用最新版本( @angular/cli
),则还需要全局安装
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.