无法解析依赖项:npm ERR!同行@angular/compiler@"11.2.8"

问题描述

我正在尝试让我的应用程序部署在 Heroku 上。我收到了“sh: 1: ng: not found”错误,但根据这里的回复,我移动了我的@angular/cli、@angular-devkit/build-angular、@angular/compiler-cli 和 typescript。现在我收到“无法解析依赖项:npm ERR!peer @angular/compiler@"11.2.8"” 错误。我认为它有一个版本问题?我不确定发生了什么。

我尝试运行“npm update”并尝试手动将“@angular/compiler@"11.2.8"”插入依赖项,然后运行“npm i”,但两者都给我同样的错误

这是我的错误

npm ERR! Found: @angular/compiler@11.0.9
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"~11.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"11.2.8" from @angular/compiler-cli@11.2.8
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"^11.0.9" from the root project
npm ERR!   peer @angular/compiler-cli@"^11.0.0" from @angular-devkit/build-angular@0.1100.7
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     @angular-devkit/build-angular@"~0.1100.2" from the root project

Package.json:

"scripts": {
    "ng": "ng","start": "ng serve","build": "ng build","test": "ng test","lint": "ng lint","e2e": "ng e2e","postinstall": "ngcc"
  },"private": true,"dependencies": {
    "@angular-devkit/build-angular": "~0.1100.2","@angular/animations": "~11.0.1","@angular/cdk": "^11.2.6","@angular/cli": "~11.0.2","@angular/common": "~11.0.1","@angular/compiler": "~11.0.1","@angular/core": "~11.0.1","@angular/flex-layout": "^11.0.0-beta.33","@angular/forms": "~11.0.1","@angular/material": "^11.2.6","@angular/platform-browser": "~11.0.1","@angular/platform-browser-dynamic": "~11.0.1","@angular/router": "~11.0.1","angular-in-memory-web-api": "^0.11.0","rxjs": "~6.6.0","tslib": "^2.0.0","typescript": "~4.0.2","uuid": "^3.4.0","zone.js": "~0.10.2"
  },"devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.2","@angular/compiler-cli": "^11.0.9","@types/jasmine": "~3.6.0","@types/node": "^12.11.1","codelyzer": "^6.0.0","jasmine-core": "~3.6.0","jasmine-spec-reporter": "~5.0.0","karma": "~5.1.0","karma-chrome-launcher": "~3.1.0","karma-coverage": "~2.0.3","karma-jasmine": "~4.0.0","karma-jasmine-html-reporter": "^1.5.0","protractor": "~7.0.0","ts-node": "~8.3.0","tslint": "~6.1.0","typescript": "~4.0.2"
  }

如何解决这个错误

解决方法

除了使用 npm install --save --legacy-peer-deps 命令行选项外,还可以将其设置为更永久的配置选项: npm config set legacy-peer-deps true

如果上述方法不起作用,请尝试删除 node_modules 文件夹和 package-lock.json 文件并运行命令 npm install

,

听起来像是 Peer Dependencies 的问题,请尝试使用 error: build error: Error processing tar file(exit status 1): Error setting up pivot dir: mkdir /var/lib/docker/overlay2/40221e791ab4c4d6d3610948703fe0eeb46618d6444a32e1bedcde3908ec5c7f/merged/usr/local/bin/flask/.pivot_root034225158: not a directory

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...