Issue
I get this error when I try to upgrade to Angular 8.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: comprehensivedashboard@0.0.0
npm ERR! Found: @angular/animations@7.2.6
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"~8.2.14" from the root project
npm ERR! peer @angular/animations@">=7.0.0" from @angular/material@7.3.3
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"~8.2.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @angular/animations@"~8.2.14" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@8.2.14
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"8.2.14" from @angular/animations@8.2.14
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"~8.2.14" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\vakkinen\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\vakkinen\AppData\Local\npm-cache_logs\2021-10-05T12_19_50_257Z-debug.log
So decided to create a brand new Angular8 app and see what the package.json file looks like. That file is attached below. Then I added all the packages I need to this brand new empty project one at a time. The application build succeeded and I was able to run the application. So I copied and pasted all the dependencies and devDependencies to the old project package.json. That project still fails npm i
because of the same error above. So I tried to clone the repo into a new directory and replaced the contents of the package.json with the contents of the package.json from the brand new empty project, still the same error. What am I doing wrong ?
{
"name": "dashboard",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "8.2.3",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/material": "~8.2.3",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"@ng-bootstrap/ng-bootstrap": "^5.3.0",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"@swimlane/ngx-charts": "^11.0.0",
"fusioncharts": "^3.15.0-sr.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ngx-bootstrap": "^3.2.0",
"ngx-csv": "^0.3.1",
"ngx-export-as": "1.4.2",
"ngx-scrollbar": "^4.1.1",
"ngx-select-dropdown": "^1.0.1",
"node-sass": "^4.14.0",
"rxjs": "~6.4.0",
"sass-loader": "^8.0.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~8.3.29",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Solution
There should be a file called package-lock in the same folder as the package file. Delete it and the error should go away. The package-lock file contains all dependencies of your dependencies and their versions. Deleting it doesn’t affect your project since it’s regenerated on npm install.
Answered By - Marijn Kneppers
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.