我最近使用 ng 更新将我的项目从角度 7 更新到 8。一切正常,但我发现 Angular Universal 没有更新到版本 8。
当我检查我的ng更新时,我有这一行
ng update @nguniversal/aspnetcore-engine
但是当我尝试更新时出现以下错误:
Package '@nguniversal/aspnetcore-engine' is not a dependency.
Angular Universal 没有更新,这里是我的包.json。如何更新 Angular Universal 以及为什么无法使用 ng 更新。
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/platform-server": "^8.2.14",
"@angular/pwa": "~0.803.23",
"@angular/router": "^8.2.14",
"@angular/service-worker": "8.2.14",
"@ngrx/effects": "8.6.0",
"@ngrx/entity": "8.6.0",
"@ngrx/router-store": "8.6.0",
"@ngrx/store": "^8.6.0",
"@ngrx/store-devtools": "8.6.0",
"@nguniversal/common": "^7.1.1",
"@nguniversal/express-engine": "^7.1.1",
"@nguniversal/module-map-ngfactory-loader": "^7.1.1",
"@taoqf/javascript-state-machine": "^3.0.8",
"angular7-csv": "^0.2.12",
"bootstrap": "^4.3.1",
"chart.js": "^2.8.0",
"core-js": "^2.6.10",
"flag-icon-css": "^3.4.2",
"font-awesome": "^4.7.0",
"ng2-file-upload": "^1.2.0",
"ngx-captcha": "^6.4.0",
"ngx-cookie": "^4.1.2",
"ngx-infinite-scroll": "^7.2.0",
"primeicons": "^2.0.0",
"primeng": "^7.1.3",
"rxjs": "^6.5.4",
"ts-helpers": "^1.1.1",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.23",
"@angular/cli": "~8.3.23",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@ngrx/schematics": "^8.6.0",
"@types/google.analytics": "0.0.39",
"@types/jasmine": "3.3.8",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"protractor": "~5.4.1",
"rxjs-tslint": "^0.1.7",
"ts-loader": "^4.5.0",
"ts-node": "^7.0.1",
"tslint": "~5.11.0",
"typescript": "~3.5.3",
"webdriver-manager": "12.1.1",
"webpack-cli": "^3.3.9"
}
希望有人能帮助我。
谢谢
我在从 Angular 9 升级到 Angular 8 时遇到了同样的问题,我通过升级使用它的软件包来修复它。
看看依赖项中的 nguniversal 包
"@nguniversal/common": "^7.1.1",
"@nguniversal/express-engine": "^7.1.1",
"@nguniversal/module-map-ngfactory-loader": "^7.1.1",
尝试升级 @nguniversal/module-map-ngfactory-loader (ng update @nguniversal/module-map-ngfactory-loader
(。