【发布时间】:2021-11-25 17:40:19
【问题描述】:
我在尝试升级到 Angular 8 时收到此错误。
npm WARN 旧锁文件
npm WARN old lockfile package-lock.json 文件是用 旧版本的 npm,
npm WARN 旧锁文件,因此必须从中获取补充元数据 注册表。
npm WARN 旧锁文件
npm WARN old lockfile 这是一次性修复,请耐心等待...
npm WARN 旧锁文件
npm 错误!代码 ERESOLVE
npm 错误! ERESOLVE 无法解决
npm 错误!
npm 错误!解析时:comprehensivedashboard@0.0.0
npm 错误!找到:@angular/animations@7.2.6
npm 错误! node_modules/@angular/动画
npm 错误! @angular/animations@"~8.2.14" 来自根项目
npm 错误!对等 @angular/animations@">=7.0.0" 来自 @angular/material@7.3.3
npm 错误! node_modules/@angular/material
npm 错误! @angular/material@"~8.2.3" 来自根项目
npm 错误!
npm 错误!无法解析依赖:
npm 错误! @angular/animations@"~8.2.14" 来自根项目
npm 错误!
npm 错误!冲突的对等依赖:@angular/core@8.2.14
npm 错误! node_modules/@angular/core
npm 错误!对等 @angular/core@"8.2.14" 来自 @angular/animations@8.2.14
npm 错误! node_modules/@angular/动画
npm 错误! @angular/animations@"~8.2.14" 来自根项目
npm 错误!
npm 错误!修复上游依赖冲突,或者重试
npm 错误!此命令带有--force 或--legacy-peer-deps
npm 错误!接受一个不正确的(并且可能被破坏的)依赖 分辨率。
npm 错误!
npm 错误!看 C:\Users\vakkinen\AppData\Local\npm-cache\eresolve-report.txt 完整报告。
npm 错误!可以在以下位置找到此运行的完整日志:
npm 错误!
C:\Users\vakkinen\AppData\Local\npm-cache_logs\2021-10-05T12_19_50_257Z-debug.log
于是决定创建一个全新的 Angular8 应用程序,看看 package.json 文件长什么样。该文件附在下面。然后我一次一个地将我需要的所有包添加到这个全新的空项目中。应用程序构建成功,我能够运行该应用程序。所以我将所有依赖项和devDependencies复制并粘贴到旧项目package.json中。由于上述相同的错误,该项目仍然失败npm i。所以我尝试将 repo 克隆到一个新目录中,并将 package.json 的内容替换为全新的空项目中的 package.json 的内容,仍然是同样的错误。我做错了什么?
{
"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"
}
}
【问题讨论】:
-
尝试删除 package-lock.json 并重新运行命令
标签: node.js angular angularjs npm npm-install