简体   繁体   English

Angular-Cli-更新后无法服务项目

[英]Angular-cli - Cannot serve project after updates

I have updated both npm , node and angular-cli to the latest versions. 我已经将npmnodeangular-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 cleanre-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.

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