Primeng: Metadata version mismatch for module

Created on 9 Nov 2017  路  15Comments  路  Source: primefaces/primeng

ERROR in Error: Metadata version mismatch for module D:/dempApp/node_modules/primen
g/components/common/api.d.ts, found version 4, expected 3, resolving symbol AppM
odule in D:/dempApp/src/app/app.module.ts, resolving symbol AppModule in D:/dempApp/sr
c/app/app.module.ts

And my package.json

{
"name": "dempApp",
"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": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"primeng": "^5.0.0-rc.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}

Most helpful comment

Wanted to post the same. Strangely the following works for me:
If I remove everything from primeng in app.module.ts.
And then run ng serve it builds normally which is expected. However if I then reinsert the primeng imports in AppModule it is working without errors.

Still I think that this problem needs a fix.

All 15 comments

Wanted to post the same. Strangely the following works for me:
If I remove everything from primeng in app.module.ts.
And then run ng serve it builds normally which is expected. However if I then reinsert the primeng imports in AppModule it is working without errors.

Still I think that this problem needs a fix.

Just to confirm what @kolomu said. it happened to me, and I tested this.
Commented out code in app.module.ts compiled fine. Then uncommented and it works.

The same thing happened to me when I upgraded my project to Angular 5 and then upgraded to primeNG 5.0.0-rc.0. Any idea on how to fix the issue? The weird thing in my case is that in my app's package.json I see the following version of @angular dependencies:

Example

"@angular/common": "^4.2.4"

But in the package.json of the primeng module I see the following:

Example

"@angular/common": "5.0.0"

The same thing happened to me when I upgraded my project to Angular 5 and then upgraded to primeNG 5.0.0-rc.0. Any idea on how to fix the issue? The weird thing in my case is that in my app's package.json I see the following version of @angular dependencies:

Example

"@angular/common": "^4.2.4"

But in the package.json of the primeng module I see the following:

Example

"@angular/common": "5.0.0"

Yeah it is indeed the version mismatch. I had @angular/common': 4.2.4and my primeng: 5.0.0-rc. I changed the primeng to: primeng:^4.2.4

This fixed the issue for me

@Mitta the same thing happens if you revert back to PrimeNG version 4.3.0 it works. But I don't think this is the solution to manually downgrade the versions. I think they need to fix the package module or else what is the purpose of the new PrimeNG 5 release.

The same thing happened to me when I upgraded my project to Angular 5 and then upgraded to primeNG 5.0.0-rc.0. Any idea on how to fix the issue? The weird thing in my case is that in my app's package.json I see the following version of @angular dependencies: "@angular/common": "^4.2.4"

After an update to Angular 5, all @angular-entries in your package.json are supposed to point to "^5.0.0".

update your angular CLI
https://github.com/angular/angular-cli#updating-angular-cli

Same here. From what I understand this is related to a version upgrade in the Angular AOT compiler which creates those *.metadata.json files. So we all have to upgrade to Angular 5, right? Otherwise primeng version 5 won't work, correct.

Yes, PrimeNG 5 does not work with Angular 4 due to metadata.json files. You need Angular 5 to use PrimeNG 5. On the other hand, PrimeNG 4.x is for Angular 4.

I have updated the project I use PrimeNG in to use Angular 5. However, not entirely without pain due to a regression in Angular 5 which breaks AOT for our project. You might want to consider releasing updates to PrimeNG version 4 with bug fixes for another one or two months.

@Eventyret

Commenting & Saving App.module.ts And again Un-commenting & Save, saved the time. Thanks.

I got this issue and was not using PrimeNG. @vv3k sugestion worked for me

For some weird reason @vv3k suggestion works. Thank you!

We just ran into this as we upgraded to Primeng 5.2.3 while still on Angular 4.2 in order to get some newer functionality with p-dropdown. Where does Primeng list what versions of Angular their releases work with? The NPM page doesn't mention version dependencies with Angular.

I am using angular 4.4.6 and must continue to use it and I am using primeng v5.2.4 'cause I like what it offers. I am running into the same error - Metadata version mismatch for module.
kolomu's fix worked on my mac, but not on my windows.
Please help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markgoho picture markgoho  路  3Comments

watalberto picture watalberto  路  3Comments

Helayxa picture Helayxa  路  3Comments

just-paja picture just-paja  路  3Comments

Faigjaz picture Faigjaz  路  3Comments