发生未处理的异常:无法读取未定义的属性“减号”

Sho*_*war 20 node.js angularjs

我使用命令卸载并安装 NPM

npm install
Run Code Online (Sandbox Code Playgroud)

并在此之后出错我也尝试过

npm audit fix --force
Run Code Online (Sandbox Code Playgroud)

在那之后错误来了

An unhandled exception occurred: Cannot read property 'Minus' of undefined
See "/private/var/folders/8n/6vsx9lx93lx9wrgxm1q_yv4c0000gn/T/ng-pMlA9a/angular-errors.log" for further details.
npm ERR! Test failed. See above for more details.
Run Code Online (Sandbox Code Playgroud)

Ale*_*fin 14

得到同样的错误。这是@angular/compiler-cli 新版本中的错误,已通过将版本降级到“10.0.12”来修复

更新。检查新版本“@angular/compiler”:“~10.1.1” - 工作正常


And*_*rew 11

我必须运行以下命令:

ng update @angular/cli @angular/core --allow-dirty --force
Run Code Online (Sandbox Code Playgroud)

然后删除线

"es5BrowserSupport": true
Run Code Online (Sandbox Code Playgroud)

来自

angular.json
Run Code Online (Sandbox Code Playgroud)

文件。


dar*_*usz 9

在此处输入图片说明

这就是我所做的,在终端中清楚地说:

ng update @angular/cli  
Run Code Online (Sandbox Code Playgroud)
ng update @angular/core 
Run Code Online (Sandbox Code Playgroud)
ng update rxjs
Run Code Online (Sandbox Code Playgroud)


Mig*_*cho 6

这有点奇怪,但是yarn install而不是 npm install 为我做到了。


小智 5

尝试更新到 package.json 中所有依赖项的最新版本。我遇到了同样的问题,并花了 2 周的时间找到了正确的解决方案。做“ng update”,它会起作用。