【问题标题】:What is the correct way of solving npm dependency tree errors?解决 npm 依赖树错误的正确方法是什么?
【发布时间】:2022-11-15 13:04:29
【问题描述】:

运行npx npm-check-updates -u 后,我尝试运行npm install,并收到以下消息:

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @nestjs/typeorm@8.0.3
npm ERR! node_modules/@nestjs/typeorm
npm ERR!   @nestjs/typeorm@"^8.1.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @nestjs/typeorm@"^8.1.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typeorm@0.3.6
npm ERR! node_modules/typeorm
npm ERR!   peer typeorm@"^0.3.0" from @nestjs/typeorm@8.1.4
npm ERR!   node_modules/@nestjs/typeorm
npm ERR!     @nestjs/typeorm@"^8.1.4" 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.

我搜索过,看到人们建议只使用 --legacy-peer-deps--force,但应该这样解决吗?还是我应该手动解决问题?

我尝试搜索有关如何解决依赖关系树错误的指南,但找不到任何内容。你能给我一些指导,我应该从哪里开始解决错误。

【问题讨论】:

  • 你找到解决办法了吗? @nestjs/typeorm 从8.1.0 开始使用 0.3 版本,所以它应该可以工作但没有。

标签: node.js npm nestjs node-modules npm-install


【解决方案1】:

我通过以下步骤修复它:

  • 重启电脑
  • 再次删除并克隆项目
  • 再次npm i,一切都很好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 2021-06-25
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    相关资源
    最近更新 更多