更新Angular Cli to 8
的版本时遇到以下错误。
Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
Error: Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
at Object.resolve (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:151:11)
at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:31:40)
at ServeCommand.initialize (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:135:55)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
答案 0 :(得分:0)
如果要升级到Angular 8,则应通过运行以下命令来确保Angular软件包安全updated到当前的稳定版本
ng update
否则,您可以尝试手动手动更新@angular/cli
和核心框架程序包。
ng update @angular/cli @angular/core
或者,您可以直接使用npm进行安装/更新。
npm install --save-dev @angular-devkit/build-angular
可以逐步找到Angular升级指南here。
答案 1 :(得分:0)
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@latest
然后在您的本地项目包中:
rm -rf node_modules dist
npm install --save-dev @angular/cli@latest
npm i
ng update --all --force
npm install --save-dev @angular-devkit/build-angular
您的应用现已升级到最新版本