1
votes
my `package.json` file is

    {
      "name": "lg-app",
      "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.4.6",
        "@angular/cdk": "^5.1.1",
        "@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/material": "^5.1.1",
        "@angular/platform-browser": "^4.2.4",
        "@angular/platform-browser-dynamic": "^4.2.4",
        "@angular/router": "^4.2.4",
        "angular-4-data-table": "^0.4.3",
        "bootstrap": "^4.0.0-beta.3",
        "core-js": "^2.4.1",
        "rxjs": "^5.4.2",
        "zone.js": "^0.8.14"
      },
      "devDependencies": {
        "@angular/cli": "^1.6.6",
        "@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"
      }
    }

This is my package.json file. I also upgraded cdk any angular material but it didn't worked.

ERROR in Error: Metadata version mismatch for module E:/angular2/lg-app/node_mod ules/@angular/material/form-field/typings/index.d.ts, found version 4, expected 3, resolving symbol AppModule in E:/angular2/lg-app/src/app/app.module.ts, resol ving symbol AppModule in E:/angular2/lg-app/src/app/app.module.ts at syntaxError (E:\angular2\lg-app\node_modules\@angular\compiler\bundles\co mpiler.umd.js:1729:34) at simplifyInContext (E:\angular2\lg-app\node_modules\@angular\compiler\bund les\compiler.umd.js:24979:23) at StaticReflector.simplify (E:\angular2\lg-app\node_modules\@angular\compil er\bundles\compiler.umd.js:24991:13) at StaticReflector.annotations (E:\angular2\lg-app\node_modules\@angular\com piler\bundles\compiler.umd.js:24418:41) at _getNgModuleMetadata (E:\angular2\lg-app\node_modules\@angular\compiler-c li\src\ngtools_impl.js:138:31) at _extractLazyRoutesFromStaticModule (E:\angular2\lg-app\node_modules\@angu lar\compiler-cli\src\ngtools_impl.js:109:26) at Object.listLazyRoutesOfModule (E:\angular2\lg-app\node_modules\@angular\c ompiler-cli\src\ngtools_impl.js:53:22) at Function.NgTools_InternalApi_NG_2.listLazyRoutes (E:\angular2\lg-app\node _modules\@angular\compiler-cli\src\ngtools_api.js:91:39) at AotPlugin._getLazyRoutesFromNgtools (E:\angular2\lg-app\node_modules\@ngt ools\webpack\src\plugin.js:241:66) at _donePromise.Promise.resolve.then.then.then.then.then (E:\angular2\lg-app \node_modules\@ngtools\webpack\src\plugin.js:495:24) at

2

2 Answers

1
votes

You got this error because you have different angular packages version. All your angular packages should be either ^4.2.4 or ^5.1.1.

After that decision you should use packages for Angular 4 or Angular 5. This isn't mandatory as many packages for Angular 4 works with Angular 5 (but not the other way around).

UPDATE

BEFORE ANYTHING DO A BACKUP

If you want to update the application to 5.1.1 i suggest you to manually change the package.json, changing all @angular package from "^4.2.4" to "^5.1.1". You must change the @angular/compiler-cli and @angular/language-service in devDependencies too.

Delete node_modules folder and run npm install.

Then update angular-4-data-table to https://github.com/ggmod/angular-5-data-table.

0
votes

As already mentioned by gmazzotti you need to have matching versions.

For Angular CLI users like you there is a nice resource here where you can compare packages, config files etc between projects generated with different versions of Angular CLI. Example, say you want to upgrade a project that was created using Angular CLI 1.5.0 to the latest Angular CLI (today that is 1.6.7), the you select those two branches in the repo, diff them and get this nice summary of everything that has changed: difference between 1.5.0 and 1.6.7.