尝试 npm install 时出现多个错误

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

我已经克隆了一个 git 存储库,并尝试在浏览器中运行该应用程序。问题是我使用了“npm install”,但它没有安装所有内容,我再次尝试 npm install 并收到以下错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"~10.0.0" from the root 
project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^16.0.0" from @angular- 
devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"^16.2.0" from the 
root 
project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^16.0.0" from @angular- 
devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^16.2.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.

我该如何解决这个问题? 我尝试使用创建项目的节点版本 14.15.1,但 Visual Studio Code 一直说不再支持该版本并要求我更新到最新版本。

安装和卸载node,使用不同版本,删除node_modules文件夹,

node.js angular typescript cordova ionic-framework
1个回答
0
投票

尝试使用 --legacy-peer-deps 标志

像这样:

npm install --legacy-peer-deps

您的 package.json 中可能有依赖于过时/已弃用版本的软件包,升级它们将是重大更改,因此会陷入困境。

使用旧版对等依赖项(旧版对等依赖项)运行将遍历您的包锁 json 并搜索要安装的对等依赖项的最新已知良好版本。

© www.soinside.com 2019 - 2024. All rights reserved.