我已从Angular 4.0.0迁移到5.2.0。
在做出推荐的更改之后,我发现了一个奇怪的错误,指出了一些错误:
ERROR in Error: Metadata version mismatch for module /home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/src/app/app.module.ts, found version 3, expected 4
at StaticSymbolResolver.getModuleMetadata (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler/bundles/compiler.umd.js:29736:34)
at StaticSymbolResolver._createSymbolsOf (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler/bundles/compiler.umd.js:29468:46)
at StaticSymbolResolver.resolveSymbol (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler/bundles/compiler.umd.js:29124:14)
at StaticReflector.findSymbolDeclaration (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler/bundles/compiler.umd.js:31640:67)
at StaticReflector.findDeclaration (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler/bundles/compiler.umd.js:31615:21)
at Object.listLazyRoutesOfModule (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:51:37)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (/home/khalidvm/Desktop/Workspace/Front/Migration Angular 4 5/frontend_v2/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:495:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
问题似乎是有些库需要更新。
我的 package.json 如下所示:
{
"name": "nomadis",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"karma": "ng test",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "5.2.0",
"@angular/common": "5.2.0",
"@angular/compiler": "5.2.0",
"@angular/core": "5.2.0",
"@angular/forms": "5.2.0",
"@angular/http": "5.2.0",
"@angular/platform-browser": "5.2.0",
"@angular/platform-browser-dynamic": "5.2.0",
"@angular/platform-server": "5.2.0",
"@angular/router": "5.2.0",
"angular-2-local-storage": "1.0.1",
"angular2-drag-scroll": "1.2.6",
"angular2-jwt": "0.2.3",
"angular2-modal": "2.0.3",
"angular2-multiselect-dropdown": "1.3.6",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",
"hammerjs": "2.0.8",
"jest-preset-angular": "2.0.5",
"json2typescript": "0.9.5",
"lodash": "^4.12.0",
"moment": "2.18.1",
"ng-http-interceptor": "4.0.0",
"ng2-smart-table": "1.1.0",
"ngx-bootstrap": "1.6.6",
"ngx-filesaver": "0.0.2",
"ngx-pagination": "3.0.1",
"ngx-tooltip": "0.0.9",
"npm": "^5.2.0",
"proxy-polyfill": "0.1.7",
"rxjs": "^5.1.0",
"sha1": "1.1.1",
"smoothscroll-polyfill": "0.3.5",
"web-animations-js": "2.2.5",
"zone.js": "^0.8.8"
},
"devDependencies": {
"@angular/cli": "^1.2.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/jest": "^20.0.5",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"jest": "^20.0.4",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-jest": "^20.0.7",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "2.4.2"
},
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
"transformIgnorePatterns": [
"node_modules/(?!json2typescript|angular2-multiselect-dropdown|ngx-filesaver|ngx-bootstrap|angular2-drag-scroll)"
]
}
}
如果有依赖更新,那么,是什么?
我试图调试,以了解问题的根源。但是我没有抓到任何东西。
我正在构建我的应用程序: Angular-CLI: 1.6.0 节点: 8.0.0 npm: 5.3.0
建议?
答案 0 :(得分:0)
如果您在执行npm install
时阅读输出,它会告诉您依赖关系失败的确切位置:
npm WARN angular2-jwt@0.2.3 requires a peer of @angular/core@^2.0.0||^4.0.0 but none was installed.
npm WARN angular2-jwt@0.2.3 requires a peer of @angular/http@^2.0.0||^4.0.0 but none was installed.
npm WARN ngx-tooltip@0.0.9 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angular2-drag-scroll@1.2.6 requires a peer of @angular/common@^2.3.1 but none was installed.
npm WARN angular2-drag-scroll@1.2.6 requires a peer of @angular/compiler@^2.3.1 but none was installed.
npm WARN angular2-drag-scroll@1.2.6 requires a peer of @angular/core@^2.3.1 but none was installed.
npm WARN angular2-modal@2.0.3 requires a peer of @angular/core@^2.1.1 but none was installed.
npm WARN angular2-modal@2.0.3 requires a peer of @angular/common@^2.1.1 but none was installed.
npm WARN ng2-smart-table@1.1.0 requires a peer of @angular/common@^4.0.0 but none was installed.
npm WARN ng2-smart-table@1.1.0 requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN ng2-smart-table@1.1.0 requires a peer of @angular/forms@^4.0.0 but none was installed.
npm WARN codelyzer@2.0.1 requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN codelyzer@2.0.1 requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN @angular/compiler-cli@4.4.6 requires a peer of @angular/compiler@4.4.6 but none was installed.
npm WARN @angular/compiler-cli@4.4.6 requires a peer of @angular/core@4.4.6 but none was installed.
npm WARN @schematics/angular@0.1.13 requires a peer of @angular-devkit/schematics@0.0.46 but none was installed.
npm WARN @schematics/schematics@0.0.13 requires a peer of @angular-devkit/schematics@0.0.46 but none was installed.
回滚到@ angular4或用@ angular5等价物更新/替换这些库。