Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata version mismatch for module #4401

Closed
sruthymoljoseph opened this issue Nov 9, 2017 · 15 comments
Closed

Metadata version mismatch for module #4401

sruthymoljoseph opened this issue Nov 9, 2017 · 15 comments

Comments

@sruthymoljoseph
Copy link

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"
}
}

@kolomu
Copy link

kolomu commented Nov 9, 2017

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.

@Eventyret
Copy link

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.

@jhonnathan78
Copy link

jhonnathan78 commented Nov 10, 2017

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"

@Mitta
Copy link

Mitta commented Nov 10, 2017

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.4 and my primeng: 5.0.0-rc. I changed the primeng to: primeng:^4.2.4

This fixed the issue for me

@jhonnathan78
Copy link

jhonnathan78 commented Nov 10, 2017

@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.

@nhnb
Copy link
Contributor

nhnb commented Nov 13, 2017

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".

@p4cm4n972
Copy link

@mbaer3000
Copy link
Contributor

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.

@cagataycivici
Copy link
Member

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.

@mbaer3000
Copy link
Contributor

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.

CloudNiner pushed a commit to azavea/temperate that referenced this issue Dec 5, 2017
Much fun here.

Updates dependencies to the latest version of Angular 4.

This caused a few build issues:

One is that climate-change-components specifies versions
of Angular to use while building. If the Angular versions
here don't match that, we get build issues that look like:

"Error encountered resolving symbol values statically.
Calling function 'InjectionToken', function calls are
not supported."

To address this it is possible to force our project's
typescript compiler to always use the versions of certain
packages via the "files" config of tsconfig.json. This
gives us a little flexibility in which Angular version
gets used in the parent project. We still should respect
the Angular version requirements of the components lib,
but that restriction is far more lax than the specific
Angular version the components lib is built with.

Another build issue was caused by ng2nouislider being
updated to 1.7.5 based on the ^1.6.2 restriction in
package.json. 1.7.5. is built with a version of Angular
CLI designed for use with Angular 5. This led to the
error:

"ERROR in Error: Metadata version mismatch for module
/opt/planit/angular/planit/node_modules/ng2-nouislider/src/nouislider.d.ts,
found version 4, expected 3, resolving symbol SharedModule
in /opt/planit/angular/planit/src/app/shared/shared.module.ts,
resolving symbol SharedModule in
/opt/planit/angular/planit/src/app/shared/shared.module.ts"

A GitHub issue on a different project with the same
issue provided enough info to pinpoint the solution,
which was to use a version of ng2nouislider built with
Angular CLI compatible with Angular 4.

primefaces/primeng#4401
@vv3k
Copy link

vv3k commented Dec 11, 2017

@Eventyret

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

@shiamalon
Copy link

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

@washingtong33k
Copy link

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

@rfmatos
Copy link

rfmatos commented Mar 20, 2018

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.

@narain39
Copy link

narain39 commented Apr 2, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests