Search code examples
aspnetboilerplate

npm install error - Metadata version mismatch


Hope somebody can help out:

I do see some warnings upon npm install

PS C:\source\Ccre\3.3.2\angular\src> npm install
npm WARN @angular/http@5.0.2 requires a peer of @angular/platform-browser@5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN nswag@11.12.9 requires a peer of npm@>=3.10.8 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 115 packages in 7.207s
PS C:\source\Ccre\3.3.2\angular\src

Then I'm just trying to run the command npm start:

ERROR

ERROR in Error: Metadata version mismatch for module c:/source/Ccre/3.3.2/angular/node_modules/abp-ng2-module/node_modules/@angular/http/http.d.ts, found version 4, expected 3, resolving symbol ABP_HTTP_PROVIDER in c:/source/Ccre/3.3.2/angular/node_modules/abp-ng2-module/src/abp.module.ts, resolving symbol RootModule in c:/source/Ccre/3.3.2/angular/src/root.module.ts, resolving symbol RootModule in c:/source/Ccre/3.3.2/angular/src/root.module.ts
    at syntaxError (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:1729:34)
    at simplifyInContext (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24979:23)
    at StaticReflector.simplify (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24991:13)
    at StaticReflector.annotations (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24418:41)
    at _getNgModuleMetadata (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:138:31)
    at _extractLazyRoutesFromStaticModule (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26)
    at Object.listLazyRoutesOfModule (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22)
    at Function.NgTools_InternalApi_NG_2.listLazyRoutes (c:\source\Ccre\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)
    at AotPlugin._getLazyRoutesFromNgtools (c:\source\Ccre\3.3.2\angular\node_modules\@ngtools\webpack\src\plugin.js:241:66)
    at _donePromise.Promise.resolve.then.then.then.then.then (c:\source\Ccre\3.3.2\angular\node_modules\@ngtools\webpack\src\plugin.js:495:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

webpack: Failed to compile.

I have already tried

1) deleting the entire folder: C:\Program Files\nodejs\node_modules

2) then reinstalled node.js

my package.json file looks like this:

{
    "name": "abp-project-name-template",
    "version": "0.0.0",
    "license": "MIT",
    "angular-cli": {},
    "scripts": {
        "ng": "ng",
        "start": "ng serve --host 0.0.0.0 --port 4200",
        "hmr": "ng serve --host 0.0.0.0 --port 4200 4201 --hmr -e=hmr",
        "test": "ng test",
        "pree2e": "webdriver-manager update --standalone false --gecko false",
        "e2e": "protractor"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "^4.3.6",
        "@angular/common": "^4.3.6",
        "@angular/compiler": "^4.3.6",
        "@angular/core": "^4.3.6",
        "@angular/forms": "^4.3.6",
        "@angular/http": "^4.3.6",
        "@angular/platform-browser": "^4.3.6",
        "@angular/platform-browser-dynamic": "^4.3.6",
        "@angular/router": "^4.3.6",
        "@types/bootstrap": "^3.3.33",
        "@types/jquery": "^3.2.12",
        "@types/jquery.blockui": "0.0.28",
        "@types/jquery.validation": "^1.16.3",
        "@types/lodash": "^4.14.62",
        "@types/moment": "^2.13.0",
        "@types/moment-timezone": "^0.2.34",
        "@types/signalr": "^2.2.33",
        "@types/toastr": "^2.1.33",
        "abp-ng2-module": "^1.2.4",
        "abp-web-resources": "^3.1.0",
        "animate.css": "^3.5.2",
        "block-ui": "^2.70.1",
        "bootstrap": "^3.3.7",
        "bootstrap-select": "^1.12.2",
        "chart.js": "^2.6.0",
        "core-js": "^2.4.1",
        "famfamfam-flags": "^1.0.0",
        "flot": "^0.8.0-alpha",
        "font-awesome": "^4.7.0",
        "jquery": "^3.1.1",
        "jquery-countto": "^1.2.0",
        "jquery-migrate": "^3.0.0",
        "jquery-slimscroll": "^1.3.8",
        "jquery-sparkline": "^2.4.0",
        "js-cookie": "^2.1.4",
        "lodash": "^4.17.4",
        "moment": "^2.18.1",
        "moment-timezone": "^0.5.13",
        "morris.js": "^0.5.0",
        "ngx-bootstrap": "^1.6.6",
        "ngx-pagination": "^3.0.0",
        "node-waves": "^0.7.5",
        "push.js": "1.0.4",
        "raphael": "^2.2.7",
        "rxjs": "^5.3.0",
        "signalr": "^2.2.1",
        "simple-line-icons": "^2.4.1",
        "spin.js": "^2.3.2",
        "sweetalert": "^1.1.3",
        "toastr": "^2.1.2",
        "ts-helpers": "^1.1.2",
        "web-animations-js": "^2.3.1",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^1.3.2",
        "@angular/compiler-cli": "^4.3.6",
        "@angularclass/hmr": "^2.1.3",
        "@types/jasmine": "^2.5.38",
        "@types/node": "^8.0.27",
        "codelyzer": "^3.1.2",
        "jasmine-core": "^2.5.2",
        "jasmine-spec-reporter": "^4.2.1",
        "karma": "^1.4.1",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-coverage-istanbul-reporter": "^1.3.0",
        "karma-jasmine": "^1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "nswag": "^11.6.1",
        "protractor": "^5.1.1",
        "ts-node": "^3.3.0",
        "tslint": "^5.7.0",
        "typescript": "^2.3.4"
    }
}

Solution

  • Remove node_modules folder and install dependencies using yarn.

    Explanation

    From this issue: https://github.com/aspnetboilerplate/module-zero-core-template/issues/141

    when i ran npm install or yarn install, it's install the latest version of each package the problem is it's installs version 4.4.6 and abp-ng2-module version 1.3,

    npm install acts like that. We are using and suggesting yarn because of prevent such problems.

    If you upgrade Angular to v5, it should work with npm.