Мы старались изо всех сил, чтобы устранить ошибку Metadata version mismatch for module
для Angular Material, которая мешает нам завершить окончательную сборку этого приложения. Для справки мы используем Angular4. Эта ошибка появляется при попытке запустить ng serve
для локального запуска приложения. Интересно то, что после запуска ng serve
и сбоя сборки из-за ошибки, приведенной ниже, если мы просто зайдем в любой файл и добавим новую пустую строку в любом месте файла и сохраним (что автоматически перезапускает ng serve
) затем приложение успешно скомпилируется (как видно в нижней части вывода консоли webpack: Compiled successfully.
- там мы добавили новую пустую строку и заново сохранили):
UserNameHere influx-archiver2 (master) > ng serve
@angular/compiler-cli@4.3.0 requires typescript@'>=2.1.0 <2.4.0' but 2.5.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript@'>=2.1.0 <2.4.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-05-11T17:33:43.081Z
Hash: d5a1d43de98307f01054
Time: 20633ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 758 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 575 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 735 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 19.5 MB [initial] [rendered]
ERROR in Error: Metadata version mismatch for module /Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/material/core/typings/index.d.ts, found version 4, expected 3, resolving symbol MatModule in /Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/src/app/shared/mat.module.ts, resolving symbol MatModule in /Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/src/app/shared/mat.module.ts
at Error (native)
at syntaxError (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler/bundles/compiler.umd.js:1725:34)
at simplifyInContext (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler/bundles/compiler.umd.js:24950:23)
at StaticReflector.simplify (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler/bundles/compiler.umd.js:24962:13)
at StaticReflector.annotations (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler/bundles/compiler.umd.js:24392:41)
at _getNgModuleMetadata (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at /Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@ngtools/webpack/src/plugin.js:240:66)
at _donePromise.Promise.resolve.then.then.then.then.then (/Users/UserNameHere/Desktop/InfluxArchiver2/influx-archiver2/node_modules/@ngtools/webpack/src/plugin.js:493:24)
at process._tickCallback (internal/process/next_tick.js:109:7)
webpack: Failed to compile.
webpack: Compiling...
Date: 2018-05-11T17:33:54.396Z - Hash: d473e8f60486dc05c5c4 - Time: 5079ms
5 unchanged chunks
webpack: Compiled successfully.
Вот наш package.json:
{
"name": "influx-archiver2",
"version": "0.0.16-SNAPSHOT",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "protractor",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"jenkins-build": "echo \"placeholder for your jenkins-build script\""
},
"private": true,
"dependencies": {
"@angular/animations": "4.3.0",
"@angular/cdk": "^5.2.4",
"@angular/common": "4.3.0",
"@angular/compiler": "4.3.0",
"@angular/core": "4.3.0",
"@angular/forms": "4.3.0",
"@angular/http": "4.3.0",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "4.3.0",
"@angular/platform-browser-dynamic": "4.3.0",
"@angular/platform-server": "4.3.0",
"@angular/router": "4.3.0",
"@swimlane/ngx-datatable": "^10.2.3",
"bootstrap": "^3.3.7",
"core-js": "^2.5.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"hover.css": "^2.2.1",
"jquery": "^3.2.1",
"ng-spin-kit": "^5.1.1",
"ng2-filter-pipe": "^0.1.10",
"ngx-bootstrap": "1.9.1",
"ngx-dropdown": "0.0.22",
"rxjs": "^5.4.3",
"tinymce": "^4.6.6",
"underscore": "^1.8.3",
"zone.js": "^0.8.17"
},
"devDependencies": {
"@angular/cli": "^1.4.9",
"@angular/compiler-cli": "4.3.0",
"@angular/language-service": "4.3.0",
"@types/jasmine": "2.5.54",
"@types/jquery": "^3.2.12",
"@types/node": "8.0.26",
"codelyzer": "3.1.2",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "0.6.0",
"protractor": "5.1.2",
"ts-node": "3.3.0",
"tslint": "5.7.0",
"typescript": "2.5.2",
"webpack": "^3.8.1"
},
"spar": {
"name": "influx-archiver2",
"rootPath": "./dist"
}
}
Любая помощь будет принята с благодарностью! Мы озадачены тем, как конкретно решить эту ошибку, и почему добавление новой пустой строки позволяет приложению компилировать
Спасибо!