简体   繁体   English

angular-cli 更新后找不到模块“@angular/core”

[英]Cannot find module '@angular/core' after angular-cli update

My application was working just well.我的应用程序运行良好。 Until I wanted to use angular-in-memory-web-api which returned undefined.直到我想使用返回未定义的 angular-in-memory-web-api。

I thought updating my angular-cli to latest may work.我认为将我的 angular-cli 更新到最新版本可能会起作用。 But now I get the 'Cannot find module '@angular/core'.但现在我得到了'找不到模块'@angular/core'。

Here are the steps I used for updating:以下是我用于更新的步骤:

Updating angular-cli更新 angular-cli

To update angular-cli to a new version, you must update both the global package and your project's local package.要将 angular-cli 更新到新版本,您必须同时更新全局包和项目的本地包。

Global package:全局包:

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
Local project package:

rm -rf node_modules dist tmp
npm install --save-dev angular-cli@latest
ng init

Looks like you deleted the node_modules folder.看起来您删除了 node_modules 文件夹。 Try running "npm install" again.再次尝试运行“npm install”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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