Metadata version mismatch for module module-map-ngfactory-loader.d.ts, found version 4, expected 3
Versions
@angular/cli: 1.4.7 node: 8.2.1 os: win32 x64 @angular/animations: 4.3.2 @angular/cdk: 2.0.0-beta.8 @angular/common: 4.3.2 @angular/compiler: 4.3.2 @angular/core: 4.3.2 @angular/forms: 4.3.2 @angular/http: 4.3.2 @angular/material: 2.0.0-beta.8 @angular/platform-browser: 4.3.2 @angular/platform-browser-dynamic: 4.3.2 @angular/platform-server: 4.3.2 @angular/router: 4.3.2 @angular/cli: 1.4.7 @angular/compiler-cli: 4.3.2 @angular/language-service: 4.3.2 typescript: 2.5.3
Repro steps
Follow guide and then run: ng build --prod
Observed behavior
Error:
ERROR in Error: Metadata version mismatch for module D:/Test/trunk/node_modules/@nguniversal/module-map-ngfactory-loader/src/module-map-ngfactory-loader.d.ts, found version 4, expected 3 at StaticSymbolResolver.getModuleMetadata (D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:25590:34) at StaticSymbolResolver._createSymbolsOf (D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:25378:46) at StaticSymbolResolver.getSymbolsOf (D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:25359:14) at D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:2421 8:30 at Array.forEach (native) at extractProgramSymbols (D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:24217:79) at AotCompiler.analyzeModulesAsync (D:\Test\trunk\node_modules@angular\compiler\bundles\compiler.umd.js:23775:47) at CodeGenerator.codegen (D:\Test\trunk\node_modules@angular\compiler-cli\src\codegen.js:32:14) at Function.NgTools_InternalApi_NG_2.codeGen (D:\Test\trunk\node_modules@angular\compiler-cli\src\ngtools_api.js:73:30) at _donePromise.Promise.resolve.then (D:\Test\trunk\node_modules@ngtools\webpack\src\plugin.js:391:44) at
Desired behavior
It should complete prod build
Mention any other details that might be useful (optional)
My package.json:
{
"name": "XXX",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "1.0.0-beta.1",
"@agm/js-marker-clusterer": "1.0.0-beta.1",
"@angular/animations": "4.3.2",
"@angular/cdk": "2.0.0-beta.8",
"@angular/common": "4.3.2",
"@angular/compiler": "4.3.2",
"@angular/core": "4.3.2",
"@angular/forms": "4.3.2",
"@angular/http": "4.3.2",
"@angular/material": "2.0.0-beta.8",
"@angular/platform-browser": "4.3.2",
"@angular/platform-browser-dynamic": "4.3.2",
"@angular/platform-server": "4.3.2",
"@angular/router": "4.3.2",
"@covalent/core": "1.0.0-beta.5-1",
"@nguniversal/module-map-ngfactory-loader": "5.0.0-beta.5",
"@satispay/web-button-factory": "1.0.4",
"@types/angular": "1.6.28",
"@types/node": "6.0.88",
"braintree-web": "3.22.2",
"braintree-web-drop-in": "1.8.0",
"classlist.js": "1.1.20150312",
"core-js": "2.4.1",
"enhanced-resolve": "3.3.0",
"hammerjs": "2.0.8",
"js-marker-clusterer": "1.0.0",
"lory.js": "2.3.3",
"md5": "2.2.1",
"moment": "2.18.1",
"ng2-cookies": "1.0.12",
"ng2-responsive": "0.8.4",
"ng2-scroll-to-el": "1.0.0",
"paypal-checkout": "4.0.133",
"rxjs": "5.4.2",
"sass-loader": "6.0.6",
"ts-loader": "3.2.0",
"web-animations-js": "2.3.1",
"zone.js": "0.8.16"
},
"devDependencies": {
"@angular/cli": "1.4.7",
"@angular/compiler-cli": "4.3.2",
"@angular/language-service": "4.3.2",
"@types/jasmine": "2.5.45",
"@types/node": "6.0.88",
"codelyzer": "3.0.1",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"ngx-swiper-wrapper": "4.6.0",
"protractor": "5.1.2",
"ts-node": "3.0.6",
"tslint": "5.3.2",
"typescript": "2.5.3",
"webpack": "3.8.1"
}
}
You need to update to Angular 5. Otherwise use an older version of @nguniversal/module-map-ngfactory-loader
Hi Cyrille and thanks
Which release should I use? The error suggests a version <4. Is this right?
I found this issue when I was using a third party lib already updated to angular package format v5. It isn't backward compatible, so with Angular 4 you cannot use libs built with this new format. I suggest to update to Angular 5.
PS this problem about specification versions is really frustrating. I have a lib on github with v4 and I cannot update it to v5, because I want to support also Angular 4. So to support both Angular 4 and 5, I have to stay to Specification v4.
@hansl do you know how libraries should handle situation like the one described by @Ks89 ?
@nguniversal/module-map-ngfactory-loader The 1.x packages work with Angular 4.x while the 5.x packages will work with Angular 5.x. We will match the major version with Angular starting from 5.0 to avoid confusion. https://github.com/angular/universal
Closing as this is working as intended.
It's not really caused by the Angular Package Format (APF) spec, but rather the different metadata versions which are incompatible.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.