发生未处理的异常:无法找到临时包的 bin:@angular/cli

ann*_*ena 6 angular-cli angular

我正在尝试按照本指南将项目的 Angular 版本从 8 更新到 11: https: //update.angular.io/?l=3& v=8.0-11.0 。到目前为止,更新到 v9 已经有效,但是在运行时ng update @angular/core@10 @angular/cli@10我现在收到一条错误消息,并且我无法在网上找到解决该问题的帖子。

\n
The installed local Angular CLI version is older than the latest stable version.\nInstalling a temporary version to perform the update.\n\xe2\x9c\x94 Package successfully installed.\nAn unhandled exception occurred: Cannot locate bin for temporary package: @angular/cli.\nSee "/private/var/folders/qy/0lhcj3516gb2hmdfcfj8jpf40000gn/T/ng-G8l2Tv/angular-errors.log" for further details.\n
Run Code Online (Sandbox Code Playgroud)\n

日志显示以下内容

\n
[error] Error: Cannot locate bin for temporary package: @angular/cli.\n    at Object.runTempPackageBin (/usr/local/lib/node_modules/@angular/cli/utilities/install-package.js:116:15)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)\n    at async UpdateCommand.validateAndRun (/usr/local/lib/node_modules/@angular/cli/models/command.js:136:22)\n    at async Object.runCommand (/usr/local/lib/node_modules/@angular/cli/models/command-runner.js:205:24)\n    at async default_1 (/usr/local/lib/node_modules/@angular/cli/lib/cli/index.js:70:31)\n
Run Code Online (Sandbox Code Playgroud)\n

我已经尝试过“npm ci”来重新安装所有节点模块,但我认为这没有帮助。有什么建议如何解决这个问题吗?

\n

Ник*_*еда 7

做这个:

  1. sudo npm uninstall -g @angular/cli
  2. sudo npm i -g @angular/cli@YOUR_LOCAL_VERSION(从package.json中获取到您的项目中)

如果没有帮助 - 添加package.json文件数据 & ng --version