无法将新包添加到旧的 Angular 7 项目

问题描述 投票:0回答:1

我正在尝试将新包添加到我现有的旧项目 Angular 7,节点版本 10.15.3。但每当我尝试执行以下“npm install @angular/[email protected] @angular/[email protected] --legacy-peer-deps 我也尝试过没有 --legacy-peer-deps”时,我得到一大堆错误。

请帮助我,我已经被这个问题困扰了近 4 天。 另外,我根据项目使用 nvm 来管理节点版本。

{
  "name": "unified",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve -o",
    "start:dev": "ng serve -o -c=dev --port=4201",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.7",
    "@angular/animations": "^7.2.15",
    "@angular/common": "^7.0.0",
    "@angular/compiler": "^7.0.0",
    "@angular/core": "^7.0.0",
    "@angular/forms": "^7.0.0",
    "@angular/http": "^7.0.0",
    "@angular/platform-browser": "^7.0.0",
    "@angular/platform-browser-dynamic": "^7.0.0",
    "@angular/router": "^7.0.0",
    "@aspnet/signalr": "^3.0.0-preview6.19307.2",
    "@ng-bootstrap/ng-bootstrap": "^4.2.2",
    "@nicky-lenaers/ngx-scroll-to": "^0.6.0",
    "@swimlane/ngx-datatable": "^16.1.1",
    "@types/jest": "^24.0.18",
    "@videojs/http-streaming": "^2.13.1",
    "angular-bootstrap-datetimepicker": "^4.0.2",
    "angular-calendar": "^0.23.7",
    "angular-notifier": "^6.0.1",
    "angular-tree-component": "^7.2.1",
    "angular2-chartjs": "^0.4.1",
    "angular2-datatable": "^0.6.0",
    "angular2-draggable": "^2.3.2",
    "angular2-lightbox": "^1.4.1",
    "bootstrap": "^4.3.1",
    "c3": "^0.4.18",
    "classlist.js": "1.1.20150312",
    "cleanup-dependencies": "0.0.6",
    "core-js": "^2.6.9",
    "css-animator": "^2.1.1",
    "d3": "^4.12.0",
    "echarts": "^4.1.0",
    "esri-loader": "^3.6.0",
    "famfamfam-flags": "^1.0.0",
    "feather-icons-sass": "^1.0.0",
    "file-saver": "^2.0.2",
    "font-awesome-scss": "^1.0.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.4.1",
    "mdbootstrap": "^4.9.0",
    "moment": "^2.24.0",
    "ng-click-outside": "^3.0.0",
    "ng-multiselect-dropdown": "^0.3.4",
    "ng-pick-datetime": "^7.0.0",
    "ng-select": "^1.0.0-rc.3",
    "ng2-archwizard": "^2.1.0",
    "ng2-dragula": "^1.5.0",
    "ng2-file-upload": "^1.4.0",
    "ng2-google-charts": "^3.5.0",
    "ng2-nouislider": "^1.8.2",
    "ng2-ui-switch": "^1.0.2",
    "ng2-validation": "^4.2.0",
    "ngx-bar-rating": "^1.1.0",
    "ngx-carousel": "^1.3.5",
    "ngx-chips": "^1.9.8",
    "ngx-color-picker": "^5.0.4",
    "ngx-echarts": "^5.0.0",
    "ngx-infinite-scroll": "^10.0.1",
    "ngx-lightbox": "^2.0.0",
    "ngx-order-pipe": "^2.0.4",
    "ngx-perfect-scrollbar": "^5.0.1",
    "ngx-pinch-zoom": "^2.4.4",
    "ngx-toastr": "^10.1.0",
    "ngx-treeview": "^6.0.2",
    "nouislider": "^11.1.0",
    "recordrtc": "^5.5.8",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.5.2",
    "screenfull": "^3.3.3",
    "sweetalert2": "^7.33.1",
    "tslib": "^1.9.0",
    "video.js": "^7.18.0",
    "web-animations-js": "^2.3.2",
    "xlsx": "^0.15.3",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "^7.0.0",
    "@angular/compiler-cli": "^7.0.0",
    "@angular/language-service": "^7.0.0",
    "@types/arcgis-js-api": "^4.14.0",
    "@types/jasmine": "^2.8.16",
    "@types/jasminewd2": "^2.0.6",
    "@types/jquery": "^3.5.5",
    "@types/node": "~8.9.4",
    "angular2-jwt": "^0.2.3",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.3.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.6",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-spec-reporter": "0.0.32",
    "node-sass": "^4.14.1",
    "protractor": "^6.0.0",
    "replace-in-file": "^4.1.3",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "3.1.6"
  }
}
6407 warn [email protected] requires a peer of @angular/core@^2.4.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
6408 warn [email protected] requires a peer of @angular/common@^2.4.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
6409 warn [email protected] requires a peer of rxjs@^5.0.1 but none is installed. You must install peer dependencies yourself.
6410 warn [email protected] requires a peer of @angular/animations@^6.0.0 but none is installed. You must install peer dependencies yourself.
6411 warn [email protected] requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself.
6412 warn [email protected] requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
6413 warn [email protected] requires a peer of @angular/forms@^6.0.0 but none is installed. You must install peer dependencies yourself.
6414 warn [email protected] requires a peer of @angular/common@>=5.0.0 but none is installed. You must install peer dependencies yourself.
6415 warn [email protected] requires a peer of @angular/core@>=5.0.0 but none is installed. You must install peer dependencies yourself.
6416 warn [email protected] requires a peer of @angular/common@^6.0.0-rc.0 || >=6.0.0 but none is installed. You must install peer dependencies yourself.
6417 warn [email protected] requires a peer of @angular/core@^6.0.0-rc.0 || >=6.0.0 but none is installed. You must install peer dependencies yourself.
6418 warn [email protected] requires a peer of @angular/core@>=5.0.0 but none is installed. You must install peer dependencies yourself.
6419 warn [email protected] requires a peer of @angular/common@>=5.0.0 but none is installed. You must install peer dependencies yourself.
6420 warn [email protected] requires a peer of @angular/core@>=5.0.0 but none is installed. You must install peer dependencies yourself.
6421 warn [email protected] requires a peer of @angular/common@^8.2.14 but none is installed. You must install peer dependencies yourself.
6422 warn [email protected] requires a peer of @angular/core@^8.2.14 but none is installed. You must install peer dependencies yourself.
6423 warn [email protected] requires a peer of @angular/core@>=6.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
6424 warn [email protected] requires a peer of @angular/common@>=6.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
6425 warn [email protected] requires a peer of @angular/platform-browser@>=6.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
6426 warn [email protected] requires a peer of @angular/common@>=6.0.0 but none is installed. You must install peer dependencies yourself.
6427 warn [email protected] requires a peer of @angular/core@>=6.0.0 but none is installed. You must install peer dependencies yourself.
6428 warn [email protected] requires a peer of @angular/forms@>=6.0.0 but none is installed. You must install peer dependencies yourself.
6429 warn [email protected] requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev but none is installed. You must install peer dependencies yourself.
6430 warn [email protected] requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev but none is installed. You must install peer dependencies yourself.
6431 warn @angular/[email protected] requires a peer of @angular/core@>=7.0.0 but none is installed. You must install peer dependencies yourself.
6432 warn @angular/[email protected] requires a peer of @angular/common@>=7.0.0 but none is installed. You must install peer dependencies yourself.
6433 warn @angular/[email protected] requires a peer of @angular/animations@>=7.0.0 but none is installed. You must install peer dependencies yourself.
6434 warn @angular/[email protected] requires a peer of @angular/core@>=7.0.0 but none is installed. You must install peer dependencies yourself.
6435 warn @angular/[email protected] requires a peer of @angular/common@>=7.0.0 but none is installed. You must install peer dependencies yourself.
6436 verbose stack Error: Refusing to delete C:\Projects\Unified\node_modules\.bin\node-gyp.cmd: is outside C:\Projects\Unified\node_modules\node-gyp and not a link
6436 verbose stack     at clobberFail (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:121:12)
6436 verbose stack     at isSafeToRm (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:114:15)
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:54:5
6436 verbose stack     at LOOP (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\slide\lib\chain.js:7:26)
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\slide\lib\chain.js:18:7
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:180:7
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\node_modules\iferr\index.js:13:50
6436 verbose stack     at _readAllLinks (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:215:28)
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\node_modules\iferr\index.js:13:50
6436 verbose stack     at resolveSymlink (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:226:22)
6436 verbose stack     at _readAllLinks (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:217:5)
6436 verbose stack     at readAllLinks (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:212:3)
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:179:5
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\node_modules\iferr\index.js:13:50
6436 verbose stack     at cb (C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
6436 verbose stack     at C:\Users\Administrator\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\gentle-fs\lib\rm.js:153:16
6437 verbose cwd C:\Projects\Unified
6438 verbose Windows_NT 10.0.22631
6439 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@angular/[email protected]" "@angular/[email protected]" "--legacy-peer-deps"
6440 verbose node v10.15.3
6441 verbose npm  v6.4.1
6442 error path C:\Projects\Unified\node_modules\.bin\node-gyp.cmd
6443 error code EEXIST
6444 error Refusing to delete C:\Projects\Unified\node_modules\.bin\node-gyp.cmd: is outside C:\Projects\Unified\node_modules\node-gyp and not a link
6445 error File exists: C:\Projects\Unified\node_modules\.bin\node-gyp.cmd
6446 error Move it away, and try again.
6447 verbose exit [ 1, true ]
angular typescript npm node-modules npm-install
1个回答
0
投票

在深入研究问题之前,我有一个问题,您是否尝试删除:

  1. 节点模块
  2. package-lock.json
  3. 清除npm缓存(npm缓存清理--force)
  4. 使用 npx 来确保您使用的是正确版本的 node-gyp? npx 节点 gyp
© www.soinside.com 2019 - 2024. All rights reserved.