I am getting below error on running ng build
command.
removed node_modules folder and npm installe giving below warning
npm WARN angular2-cool-storage@3.1.2 requires a peer of @angular/core@5.0.0 but none was installed.
npm WARN angular2-cool-storage@3.1.2 requires a peer of @angular/common@^5.0.0 but none was installed.
And for ng build below id deetail error:
ERROR in Metadata version mismatch for module /node_modules/angular2-cool-storage/index.d.ts, found version 4, expected 3, resolving symbol AppModule in /src/app/app.module.ts resolving symbol AppModule in /src/app/app.module.ts
Package.json is
{
"name": "nova-angular",
"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.3",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "^4.4.3",
"@angular/compiler": "^4.4.3",
"@angular/core": "^4.4.3",
"@angular/forms": "^4.4.3",
"@angular/http": "^4.4.3",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "^4.4.3",
"@angular/platform-browser-dynamic": "^4.4.3",
"@angular/router": "^4.4.3",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.29",
"angular2-cool-storage": "^3.1.0",
"angular2-jwt": "^0.2.3",
"bootstrap": "^3.3.7",
"classlist.js": "^1.1.20150312",
"core-js": "^2.5.0",
"ng2-cookies": "^1.0.12",
"ng2-truncate": "^1.3.10",
"rxjs": "^5.4.2",
"tslint-fix": "^0.1.0",
"zone.js": "^0.8.16"
},
"devDependencies": {
"@angular/cli": "1.3.2",
"@angular/compiler-cli": "^4.4.3",
"@angular/language-service": "^4.4.3",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "^8.0.26",
"codelyzer": "^3.1.2",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.4",
"protractor": "~5.1.2",
"ts-node": "~3.3.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2",
"typings": "^2.1.1"
}
}
Earlier I used angular2-cool-storage and now after installing and using ng2-cookies ng build is failing. Please suggest me a solution.
The message seems clear : You need a version of angular core and common that is at least 5.0.0.
Your package file show a 4.4.3 version.
Try updating your packages, or downgrading your dependencies, and try again !
For package consistency, I updated my package.json file. Removed the caret(^) from the package name so now it is not updating package headers. It forces npm to stick with the specified version only.
Check package version which is compatible earlier with the same angular version and specify those entries without ^ in package.json if auto upgardation of package occurs
Metadata version mismatch
.It seems there are a package compatibility problem, you should follow this guide to upgrade packages to angular 5 to make compatible versions for packages, I've tried it and it worked well