从 angular 8 到 9 的迁移失败 - 缺少 @Injectable 和不完整的提供者定义迁移步骤
Migration fails from angular 8 to 9 - Missing @Injectable and incomplete provider definition migration step
尝试将我的 angular 项目从 8 升级到 9 时出现以下错误:
Debug Failure. Did not expect JSDocNamepathType to have an Identifier in its trivia
我不知道这个错误是什么意思,也不知道去哪里解决这个错误。我所有的 services/resolvers/etc 都有一个 Injectable 装饰器,但我不明白为什么会失败。有人以前遇到过这个错误吗?
Package.json:
"dependencies": {
"@angular-devkit/core": "^9.0.1",
"@angular-devkit/schematics": "^9.0.1",
"@angular/animations": "^9.0.0",
"@angular/cdk": "^9.0.0",
"@angular/common": "^9.0.0",
"@angular/compiler": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
"@angular/http": "^7.2.15",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "^9.0.0",
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/platform-server": "^9.0.0",
"@angular/router": "^9.0.0",
"@angular/service-worker": "^9.0.0",
"@aspnet/signalr": "^1.1.4",
"@aspnet/signalr-protocol-msgpack": "^1.1.0",
"@nguniversal/express-engine": "^8.2.6",
"@nguniversal/module-map-ngfactory-loader": "v8.2.6",
"@schematics/angular": "^9.0.1",
"@schematics/update": "^0.900.1",
"@types/mkdirp": "^0.5.2",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.3.1",
"bundle-loader": "^0.5.6",
"core-js": "^2.6.11",
"element-remove": "^1.0.4",
"express": "^4.15.2",
"hammerjs": "^2.0.8",
"json-object-mapper": "^1.6.0",
"luxon": "^1.13.1",
"mkdirp": "^0.5.1",
"node-cache": "^5.1.0",
"node-sass": "^4.11.0",
"npm": "^6.13.4",
"preboot": "^7.0.0",
"reflect-metadata": "^0.1.13",
"request-promise": "^4.2.5",
"rxjs": "6.5.3",
"tslib": "^1.10.0",
"url-search-params-polyfill": "^6.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.1",
"@angular/cli": "^9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@types/express": "^4.17.0",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/luxon": "^1.12.0",
"@types/node": "^12.11.1",
"@types/webpack-env": "^1.15.0",
"codelyzer": "^5.1.2",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.3",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.1",
"source-map-explorer": "^1.8.0",
"ts-loader": "^5.2.0",
"ts-node": "~5.0.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "~5.9.1",
"typescript": "~3.7.5",
"webpack-bundle-analyzer": "^3.3.1",
"webpack-cli": "^3.1.0"
},
对于那些最终遇到同样问题的人,我通过从我的项目中删除 JSDoc 注释来修复它。显然,打字稿编译器存在一个错误,导致 JSDoc 注释无法正确编译。我不确定这个 bug 是否已经被 typescript 团队解决,但它需要在未来的版本中解决,因为我不是唯一一个使用 JSDoc 的人。
Angular 存储库中出现了一个关于此的问题:
https://github.com/angular/angular/issues/35233
希望这对任何人都有帮助:)
尝试将我的 angular 项目从 8 升级到 9 时出现以下错误:
Debug Failure. Did not expect JSDocNamepathType to have an Identifier in its trivia
我不知道这个错误是什么意思,也不知道去哪里解决这个错误。我所有的 services/resolvers/etc 都有一个 Injectable 装饰器,但我不明白为什么会失败。有人以前遇到过这个错误吗?
Package.json:
"dependencies": {
"@angular-devkit/core": "^9.0.1",
"@angular-devkit/schematics": "^9.0.1",
"@angular/animations": "^9.0.0",
"@angular/cdk": "^9.0.0",
"@angular/common": "^9.0.0",
"@angular/compiler": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
"@angular/http": "^7.2.15",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "^9.0.0",
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/platform-server": "^9.0.0",
"@angular/router": "^9.0.0",
"@angular/service-worker": "^9.0.0",
"@aspnet/signalr": "^1.1.4",
"@aspnet/signalr-protocol-msgpack": "^1.1.0",
"@nguniversal/express-engine": "^8.2.6",
"@nguniversal/module-map-ngfactory-loader": "v8.2.6",
"@schematics/angular": "^9.0.1",
"@schematics/update": "^0.900.1",
"@types/mkdirp": "^0.5.2",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.3.1",
"bundle-loader": "^0.5.6",
"core-js": "^2.6.11",
"element-remove": "^1.0.4",
"express": "^4.15.2",
"hammerjs": "^2.0.8",
"json-object-mapper": "^1.6.0",
"luxon": "^1.13.1",
"mkdirp": "^0.5.1",
"node-cache": "^5.1.0",
"node-sass": "^4.11.0",
"npm": "^6.13.4",
"preboot": "^7.0.0",
"reflect-metadata": "^0.1.13",
"request-promise": "^4.2.5",
"rxjs": "6.5.3",
"tslib": "^1.10.0",
"url-search-params-polyfill": "^6.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.1",
"@angular/cli": "^9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@types/express": "^4.17.0",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/luxon": "^1.12.0",
"@types/node": "^12.11.1",
"@types/webpack-env": "^1.15.0",
"codelyzer": "^5.1.2",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.3",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.1",
"source-map-explorer": "^1.8.0",
"ts-loader": "^5.2.0",
"ts-node": "~5.0.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "~5.9.1",
"typescript": "~3.7.5",
"webpack-bundle-analyzer": "^3.3.1",
"webpack-cli": "^3.1.0"
},
对于那些最终遇到同样问题的人,我通过从我的项目中删除 JSDoc 注释来修复它。显然,打字稿编译器存在一个错误,导致 JSDoc 注释无法正确编译。我不确定这个 bug 是否已经被 typescript 团队解决,但它需要在未来的版本中解决,因为我不是唯一一个使用 JSDoc 的人。
Angular 存储库中出现了一个关于此的问题: https://github.com/angular/angular/issues/35233
希望这对任何人都有帮助:)