NPM在一台机器上安装出错,另一台机器上没有问题。

huangapple go评论78阅读模式
英文:

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:

&gt; npm ERR! code ERESOLVE npm ERR!   node_modules/@angular/cdk npm ERR!  
&gt; @angular/cdk@&quot;^12.1.0&quot; from the root project npm ERR! npm ERR! Fix the
&gt; upstream dependency conflict, or retry npm ERR! this command with
&gt; --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See
&gt; C:\Users\MY-USER_Folder\AppData\Local\npm-cache\eresolve-report.txt
&gt; for a full report.
&gt; 
&gt; npm ERR! A complete log of this run can be found in: npm ERR!    
&gt; 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:

    {
      &quot;name&quot;: &quot;ngx-admin&quot;,
      &quot;version&quot;: &quot;10.0.0&quot;,
      &quot;license&quot;: &quot;MIT&quot;,
      &quot;repository&quot;: {
        &quot;type&quot;: &quot;git&quot;,
        &quot;url&quot;: &quot;git+https://github.com/akveo/ngx-admin.git&quot;
      },
      &quot;bugs&quot;: {
        &quot;url&quot;: &quot;https://github.com/akveo/ngx-admin/issues&quot;
      },
      &quot;scripts&quot;: {
        &quot;ng&quot;: &quot;ng&quot;,
        &quot;conventional-changelog&quot;: &quot;conventional-changelog&quot;,
        &quot;start&quot;: &quot;ng serve&quot;,
        &quot;build&quot;: &quot;ng build&quot;,
        &quot;build:prod&quot;: &quot;npm run build -- --configuration production --aot&quot;,
        &quot;test&quot;: &quot;ng test&quot;,
        &quot;test:coverage&quot;: &quot;rimraf coverage &amp;&amp; npm run test -- --code-coverage&quot;,
        &quot;lint&quot;: &quot;ng lint&quot;,
        &quot;lint:fix&quot;: &quot;ng lint ngx-admin-demo --fix&quot;,
        &quot;lint:styles&quot;: &quot;stylelint ./src/**/*.scss&quot;,
        &quot;lint:ci&quot;: &quot;npm run lint &amp;&amp; npm run lint:styles&quot;,
        &quot;pree2e&quot;: &quot;webdriver-manager update --standalone false --gecko false&quot;,
        &quot;e2e&quot;: &quot;ng e2e&quot;,
        &quot;docs&quot;: &quot;compodoc -p src/tsconfig.app.json -d docs&quot;,
        &quot;docs:serve&quot;: &quot;compodoc -p src/tsconfig.app.json -d docs -s&quot;,
        &quot;prepush&quot;: &quot;npm run lint:ci&quot;,
        &quot;release:changelog&quot;: &quot;npm run conventional-changelog -- -p angular -i CHANGELOG.md -s&quot;,
        &quot;postinstall&quot;: &quot;ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points --tsconfig \&quot;./src/tsconfig.app.json\&quot;&quot;
      },
      &quot;dependencies&quot;: {
        &quot;@angular/animations&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/cdk&quot;: &quot;^12.1.0&quot;,
        &quot;@angular/common&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/compiler&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/core&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/forms&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/google-maps&quot;: &quot;^12.2.13&quot;,
        &quot;@angular/platform-browser&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/platform-browser-dynamic&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/router&quot;: &quot;^14.2.12&quot;,
        &quot;@asymmetrik/ngx-leaflet&quot;: &quot;3.0.1&quot;,
        &quot;@nebular/auth&quot;: &quot;10.0.0&quot;,
        &quot;@nebular/eva-icons&quot;: &quot;10.0.0&quot;,
        &quot;@nebular/security&quot;: &quot;10.0.0&quot;,
        &quot;@nebular/theme&quot;: &quot;10.0.0&quot;,
        &quot;@swimlane/ngx-charts&quot;: &quot;^14.0.0&quot;,
        &quot;angular2-chartjs&quot;: &quot;0.4.1&quot;,
        &quot;bootstrap&quot;: &quot;4.3.1&quot;,
        &quot;chart.js&quot;: &quot;2.7.1&quot;,
        &quot;ckeditor&quot;: &quot;4.7.3&quot;,
        &quot;classlist.js&quot;: &quot;1.1.20150312&quot;,
        &quot;core-js&quot;: &quot;2.5.1&quot;,
        &quot;echarts&quot;: &quot;^4.9.0&quot;,
        &quot;eva-icons&quot;: &quot;^1.1.3&quot;,
        &quot;intl&quot;: &quot;1.2.5&quot;,
        &quot;ionicons&quot;: &quot;2.0.1&quot;,
        &quot;leaflet&quot;: &quot;1.2.0&quot;,
        &quot;monaco-editor&quot;: &quot;^0.24.0&quot;,
        &quot;nebular-icons&quot;: &quot;1.1.0&quot;,
        &quot;ng2-ckeditor&quot;: &quot;~1.2.9&quot;,
        &quot;ng2-completer&quot;: &quot;^9.0.1&quot;,
        &quot;ng2-smart-table&quot;: &quot;^1.6.0&quot;,
        &quot;ngx-echarts&quot;: &quot;^4.2.2&quot;,
        &quot;ngx-monaco-editor&quot;: &quot;^12.0.0&quot;,
        &quot;node-sass&quot;: &quot;^7.0.0&quot;,
        &quot;normalize.css&quot;: &quot;6.0.0&quot;,
        &quot;pace-js&quot;: &quot;1.0.2&quot;,
        &quot;roboto-fontface&quot;: &quot;0.8.0&quot;,
        &quot;rxjs&quot;: &quot;6.6.2&quot;,
        &quot;rxjs-compat&quot;: &quot;6.3.0&quot;,
        &quot;socicon&quot;: &quot;3.0.5&quot;,
        &quot;style-loader&quot;: &quot;^1.3.0&quot;,
        &quot;tinymce&quot;: &quot;4.5.7&quot;,
        &quot;tslib&quot;: &quot;^2.3.1&quot;,
        &quot;typeface-exo&quot;: &quot;0.0.22&quot;,
        &quot;web-animations-js&quot;: &quot;^2.3.2&quot;,
        &quot;zone.js&quot;: &quot;~0.11.4&quot;
      },
      &quot;devDependencies&quot;: {
        &quot;@angular-devkit/build-angular&quot;: &quot;^14.2.10&quot;,
        &quot;@angular-eslint/builder&quot;: &quot;14.4.0&quot;,
        &quot;@angular-eslint/eslint-plugin&quot;: &quot;14.4.0&quot;,
        &quot;@angular-eslint/eslint-plugin-template&quot;: &quot;14.4.0&quot;,
        &quot;@angular-eslint/schematics&quot;: &quot;14.4.0&quot;,
        &quot;@angular-eslint/template-parser&quot;: &quot;14.4.0&quot;,
        &quot;@angular/cli&quot;: &quot;^14.2.10&quot;,
        &quot;@angular/compiler-cli&quot;: &quot;^14.2.12&quot;,
        &quot;@angular/language-service&quot;: &quot;14.2.12&quot;,
        &quot;@compodoc/compodoc&quot;: &quot;1.0.1&quot;,
        &quot;@fortawesome/fontawesome-free&quot;: &quot;^5.2.0&quot;,
        &quot;@types/d3-color&quot;: &quot;1.0.5&quot;,
        &quot;@types/jasmine&quot;: &quot;~3.3.0&quot;,
        &quot;@types/jasminewd2&quot;: &quot;2.0.3&quot;,
        &quot;@types/leaflet&quot;: &quot;1.2.3&quot;,
        &quot;@types/node&quot;: &quot;^12.12.70&quot;,
        &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^5.36.2&quot;,
        &quot;@typescript-eslint/parser&quot;: &quot;^5.36.2&quot;,
        &quot;codelyzer&quot;: &quot;^6.0.2&quot;,
        &quot;conventional-changelog-cli&quot;: &quot;1.3.4&quot;,
        &quot;eslint&quot;: &quot;^8.23.0&quot;,
        &quot;husky&quot;: &quot;0.13.3&quot;,
        &quot;jasmine-core&quot;: &quot;~3.6.0&quot;,
        &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
        &quot;karma&quot;: &quot;~6.3.19&quot;,
        &quot;karma-chrome-launcher&quot;: &quot;~3.1.1&quot;,
        &quot;karma-cli&quot;: &quot;1.0.1&quot;,
        &quot;karma-coverage-istanbul-reporter&quot;: &quot;~3.0.2&quot;,
        &quot;karma-jasmine&quot;: &quot;~4.0.2&quot;,
        &quot;karma-jasmine-html-reporter&quot;: &quot;^1.7.0&quot;,
        &quot;npm-run-all&quot;: &quot;4.0.2&quot;,
        &quot;protractor&quot;: &quot;~7.0.0&quot;,
        &quot;rimraf&quot;: &quot;2.6.1&quot;,
        &quot;stylelint&quot;: &quot;7.13.0&quot;,
        &quot;ts-node&quot;: &quot;3.2.2&quot;,
        &quot;tslint&quot;: &quot;~6.1.0&quot;,
        &quot;tslint-language-service&quot;: &quot;^0.9.9&quot;,
        &quot;typescript&quot;: &quot;~4.6.4&quot;
      }
    }


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&#39;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>



huangapple
  • 本文由 发表于 2023年7月31日 20:01:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76803414.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定