发生未处理的异常:无法找到临时包的二进制文件:@angular/cli。

6

我正在尝试按照这个指南将一个项目从Angular 8升级到11:https://update.angular.io/?l=3&v=8.0-11.0。目前为止,升级到v9已经成功了,但是当运行ng update @angular/core@10 @angular/cli@10时,我现在遇到了一个错误消息,我找不到在线上的文章来解决它。

The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
An unhandled exception occurred: Cannot locate bin for temporary package: @angular/cli.
See "/private/var/folders/qy/0lhcj3516gb2hmdfcfj8jpf40000gn/T/ng-G8l2Tv/angular-errors.log" for further details.

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

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

2个回答

7

按照以下步骤执行:

  1. sudo npm uninstall -g @angular/cli
  2. sudo npm i -g @angular/cli@YOUR_LOCAL_VERSION (从 package.json 文件中获取版本号,添加到你的项目中)

如果以上方法无效,则需添加package.json文件数据和ng --version


4

我正在将版本从12.0.0升级到12.0.1,但是遇到了同样的错误 - 升级/安装全局 @angular/cli 解决了这个问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接