安装 npm 包时无法解决依赖树错误 [英] Unable to resolve dependency tree error when installing npm packages

查看:59
本文介绍了安装 npm 包时无法解决依赖树错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 npm i 命令安装 npm 包时,出现以下异常:

When trying to install the npm packages using npm i command, I am getting the following exception:

我尝试重新安装 Node.js 包并将代理设置为关闭使用:

I have tried reinstalling the Node.js package and setting the proxy to off using:

set HTTP_PROXY=
set HTTPS_PROXY=

问题依旧.我做错了什么?

The issue is still there. What I am doing wrong?

更新:

当我运行以下命令时:

npm install --legacy-peer-deps

显示以下错误:

推荐答案

这与 HTTP 代理无关.

This is not related to an HTTP proxy.

您有依赖冲突(不正确,并且可能破坏依赖)正如它所说,所以尝试使用 - 运行命令-force--legacy-peer-deps.如果它不生效,临时解决方案使用以前版本的 Node.js(降级 Node.js 版本),因为它会导致此类错误有时会发生.

You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to run the command with --force, or --legacy-peer-deps. If it doesn't take effect, the temporary solution is using prior versions of the Node.js (downgrading the Node.js version) as it causes this kind of errors to happen sometimes.

根据 OP 的更新进行更新:

如您所见,它会触发以下错误:

As you see, it fires the following error:

找不到与@angular/http@^9.1.4 匹配的版本.

No matching version found for @angular/http@^9.1.4.

看看angular/http页面.注意,该弃用软件包的最新版本是 7.2.16您请求更高版本(例如,^9.1.4)!因此,请尝试检查项目依赖项并按照引发的错误来解决问题.

Take a look at angular/http page. Note that the latest version for that deprecated package is 7.2.16 while you request an upper version (e.g., ^9.1.4)! So, try to check the project dependencies and follow the raised errors in order to solve the problem.

这篇关于安装 npm 包时无法解决依赖树错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆