英文:
NPM install errors on one machine, not the other
问题
我正在开发这个Angular应用程序已经几个月了,它在机器A上工作得很好。没有错误(除了我的一些拼写错误)。
下个月我要离开一段时间,所以我想在我的笔记本电脑上运行这个Angular应用程序。一切都已经安装好了(node、angular等)。我从git仓库下载了源代码,然后尝试用npm i安装node_modules,结果如下:
npm ERR! code ERESOLVE npm ERR! node_modules/@angular/cdk npm ERR!
@angular/cdk@"^12.1.0" 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\MY-USER_Folder\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\MY_USER_FOLDER\AppData\Local\npm-cache\_logs23-07-31T11_53_25_751Z-debug-0.log
当然,MY_USER_FOLDER不是真实的文件夹,但我喜欢在公共网站上删除我的用户名。
日志非常庞大,但如果需要的话,我可以提供它。也许有人对上面的错误有线索。
如有要求,这是package.json:
{
"name": "ngx-admin",
"version": "10.0.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/akveo/ngx-admin.git"
},
"bugs": {
"url": "https://github.com/akveo/ngx-admin/issues"
},
"scripts": {
"ng": "ng",
"conventional-changelog": "conventional-changelog",
"start": "ng serve",
"build": "ng build",
"build:prod": "npm run build -- --configuration production --aot",
"test": "ng test",
"test:coverage": "rimraf coverage && npm run test -- --code-coverage",
"lint": "ng lint",
"lint:fix": "ng lint ngx-admin-demo --fix",
"lint:styles": "stylelint ./src/**/*.scss",
"lint:ci": "npm run lint && npm run lint:styles",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e",
"docs": "compodoc -p src/tsconfig.app.json -d docs",
"docs:serve": "compodoc -p src/tsconfig.app.json -d docs -s",
"prepush": "npm run lint:ci",
"release:changelog": "npm run conventional-changelog -- -p angular -i CHANGELOG.md -s",
"postinstall": "ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points --tsconfig \"./src/tsconfig.app.json\""
},
"dependencies": {
"@angular/animations": "^14.2.12",
"@angular/cdk": "^12.1.0",
"@angular/common": "^14.2.12",
"@angular/compiler": "^14.2.12",
"@angular/core": "^14.2.12",
"@angular/forms": "^14.2.12",
"@angular/google-maps": "^12.2.13",
"@angular/platform-browser": "^14.2.12",
"@angular/platform-browser-dynamic": "^14.2.12",
"@angular/router": "^14.2.12",
"@asymmetrik/ngx-leaflet": "3.0.1",
"@nebular/auth": "10.0.0",
"@nebular/eva-icons": "10.0.0",
"@nebular/security": "10.0.0",
"@nebular/theme": "10.0.0",
"@swimlane/ngx-charts": "^14.0.0",
"angular2-chartjs": "0.4.1",
"bootstrap": "4.3.1",
"chart.js": "2.7.1",
"ckeditor": "4.7.3",
"classlist.js": "1.1.20150312",
"core-js": "2.5.1",
"echarts": "^4.9.0",
"eva-icons": "^1.1.3",
"intl": "1.2.5",
"ionicons": "2.0.1",
"leaflet": "1.2.0",
"monaco-editor": "^0.24.0",
"nebular-icons": "1.1.0",
"ng2-ckeditor": "~1.2.9",
"ng2-completer": "^9.0.1",
"ng2-smart-table": "^1.6.0",
"ngx-echarts": "^4.2.2",
"ngx-monaco-editor": "^12.0.0",
"node-sass": "^7.0.0",
"normalize.css": "6.0.0",
"pace-js": "1.0.2",
"roboto-fontface": "0.8.0",
"rxjs": "6.6.2",
"rxjs-compat": "6.3.0",
"socicon": "3.0.5",
"style-loader": "^1.3.0",
"tinymce": "4.5.7",
"tslib": "^2.3.1",
"typeface-exo": "0.0.22",
"web-animations-js": "^2.3.2",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.10",
"@angular-eslint/builder": "14.4.0",
"@angular-eslint/eslint-plugin": "14.4.0",
"@angular-eslint/eslint-plugin-template": "14.4.0",
"@angular-eslint/schematics": "14.4.0",
"@angular-eslint/template-parser": "14.4.0",
"@angular/cli": "^14.2.10",
"@angular/compiler-cli": "^14.2.12",
"@angular/language-service": "14.2.12",
"@compodoc/compodoc": "1.0.1",
"@
<details>
<summary>英文:</summary>
I am working on this Angular application for a few months now and it works just find on machine A. No errors (except my own stupid typos).
Next month I am going away for a while so I want to run the Angular application on my laptop. Everything is installed (node, angular, etc). I downloaded the source from the git repository and tried to install the node_modules with *npm i* and this is the result:
> npm ERR! code ERESOLVE npm ERR! node_modules/@angular/cdk npm ERR!
> @angular/cdk@"^12.1.0" 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\MY-USER_Folder\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\MY_USER_FOLDER\AppData\Local\npm-cache\_logs\2023-07-31T11_53_25_751Z-debug-0.log
Of course, MY_USER_FOLDER is not the real folder, but I like to remove my username from public websites.
The log is huge, but if needed I can provide it. Maybe someone has a clue with the errors above.
As requested the package.json:
{
"name": "ngx-admin",
"version": "10.0.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/akveo/ngx-admin.git"
},
"bugs": {
"url": "https://github.com/akveo/ngx-admin/issues"
},
"scripts": {
"ng": "ng",
"conventional-changelog": "conventional-changelog",
"start": "ng serve",
"build": "ng build",
"build:prod": "npm run build -- --configuration production --aot",
"test": "ng test",
"test:coverage": "rimraf coverage && npm run test -- --code-coverage",
"lint": "ng lint",
"lint:fix": "ng lint ngx-admin-demo --fix",
"lint:styles": "stylelint ./src/**/*.scss",
"lint:ci": "npm run lint && npm run lint:styles",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e",
"docs": "compodoc -p src/tsconfig.app.json -d docs",
"docs:serve": "compodoc -p src/tsconfig.app.json -d docs -s",
"prepush": "npm run lint:ci",
"release:changelog": "npm run conventional-changelog -- -p angular -i CHANGELOG.md -s",
"postinstall": "ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points --tsconfig \"./src/tsconfig.app.json\""
},
"dependencies": {
"@angular/animations": "^14.2.12",
"@angular/cdk": "^12.1.0",
"@angular/common": "^14.2.12",
"@angular/compiler": "^14.2.12",
"@angular/core": "^14.2.12",
"@angular/forms": "^14.2.12",
"@angular/google-maps": "^12.2.13",
"@angular/platform-browser": "^14.2.12",
"@angular/platform-browser-dynamic": "^14.2.12",
"@angular/router": "^14.2.12",
"@asymmetrik/ngx-leaflet": "3.0.1",
"@nebular/auth": "10.0.0",
"@nebular/eva-icons": "10.0.0",
"@nebular/security": "10.0.0",
"@nebular/theme": "10.0.0",
"@swimlane/ngx-charts": "^14.0.0",
"angular2-chartjs": "0.4.1",
"bootstrap": "4.3.1",
"chart.js": "2.7.1",
"ckeditor": "4.7.3",
"classlist.js": "1.1.20150312",
"core-js": "2.5.1",
"echarts": "^4.9.0",
"eva-icons": "^1.1.3",
"intl": "1.2.5",
"ionicons": "2.0.1",
"leaflet": "1.2.0",
"monaco-editor": "^0.24.0",
"nebular-icons": "1.1.0",
"ng2-ckeditor": "~1.2.9",
"ng2-completer": "^9.0.1",
"ng2-smart-table": "^1.6.0",
"ngx-echarts": "^4.2.2",
"ngx-monaco-editor": "^12.0.0",
"node-sass": "^7.0.0",
"normalize.css": "6.0.0",
"pace-js": "1.0.2",
"roboto-fontface": "0.8.0",
"rxjs": "6.6.2",
"rxjs-compat": "6.3.0",
"socicon": "3.0.5",
"style-loader": "^1.3.0",
"tinymce": "4.5.7",
"tslib": "^2.3.1",
"typeface-exo": "0.0.22",
"web-animations-js": "^2.3.2",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.10",
"@angular-eslint/builder": "14.4.0",
"@angular-eslint/eslint-plugin": "14.4.0",
"@angular-eslint/eslint-plugin-template": "14.4.0",
"@angular-eslint/schematics": "14.4.0",
"@angular-eslint/template-parser": "14.4.0",
"@angular/cli": "^14.2.10",
"@angular/compiler-cli": "^14.2.12",
"@angular/language-service": "14.2.12",
"@compodoc/compodoc": "1.0.1",
"@fortawesome/fontawesome-free": "^5.2.0",
"@types/d3-color": "1.0.5",
"@types/jasmine": "~3.3.0",
"@types/jasminewd2": "2.0.3",
"@types/leaflet": "1.2.3",
"@types/node": "^12.12.70",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"codelyzer": "^6.0.2",
"conventional-changelog-cli": "1.3.4",
"eslint": "^8.23.0",
"husky": "0.13.3",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.19",
"karma-chrome-launcher": "~3.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.2",
"karma-jasmine-html-reporter": "^1.7.0",
"npm-run-all": "4.0.2",
"protractor": "~7.0.0",
"rimraf": "2.6.1",
"stylelint": "7.13.0",
"ts-node": "3.2.2",
"tslint": "~6.1.0",
"tslint-language-service": "^0.9.9",
"typescript": "~4.6.4"
}
}
Things I tried:
- Google (duh)
- Downgrade and upgrade node and angular (cli)
- Use the npm i --force and npm i --legacy-peer-deps (gives errors)
- Try to update individual packages listed in the errors
- Reviewed the questions already asked on Stack Overflow (no helpful results)
None of these seem to work, otherwise I wouldn't be typing here.
</details>
# 答案1
**得分**: -1
这是几乎不可能找到正确答案,所以我尝试了一些不同的方法:使用不同的模板。这个模板可以在笔记本电脑和台式机上都使用。
<details>
<summary>英文:</summary>
It was almost impossible to find the right answer, so I tried something different: work with a different template. This one works on both the laptop and desktop.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论