简体   繁体   English

将 Angular v12 升级到 v13 后未捕获 TypeError

[英]Uncaught TypeError after upgrading Angular v12 to v13

I am struggling with the following error:我正在努力解决以下错误:

Uncaught TypeError: (0 , tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate) is not a function
    at Module.2200 (app.service.ts:14)
    at __webpack_require__ (bootstrap:19)
    at Module.5921 (material.module.ts:62)
    at __webpack_require__ (bootstrap:19)
    at Module.3259 (app.module.ts:125)
    at __webpack_require__ (bootstrap:19)
    at Module.3696 (main.js:18)
    at __webpack_require__ (bootstrap:19)
    at Module.4750 (app.component.ts:20)
    at __webpack_require__ (bootstrap:19)

This happened after I upgraded from v12 to v13.这发生在我从 v12 升级到 v13 之后。 I already had other issues, which I fixed, like - Getting Module not found error when upgrade angular v12 to v13 .我已经解决了其他问题,例如 - Getting Module not found error when upgrade angular v12 to v13

This is how my app.service.ts file looks like - https://stackblitz.com/edit/angular-ivy-3siaqz?file=src/app/app.service.ts , and the error is Uncaught TypeError这就是我的 app.service.ts 文件的样子 - https://stackblitz.com/edit/angular-ivy-3siaqz?file=src/app/app.service.ts ,错误是Uncaught TypeError

Please delete your node.js file and reinstall请删除您的node.js文件并重新安装

I succeeded to fix it when deleting not only the node_modules, but also the package-lock.json file, then I updated the npm version to the latest one (probably not needed) and ran:我不仅删除了node_modules,还删除了package-lock.json文件,成功修复了它,然后我将npm版本更新为最新版本(可能不需要)并运行:

npm install –legacy-peer-deps

Then the app was working properly.然后应用程序正常工作。

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

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