gpt4 book ai didi

node.js - 错误!代码 ERESOLVE npm ERR! ERESOLVE 无法解析 npm ERR!在解析 : @nestjs/mongoose@8. 0.1 时

转载 作者:行者123 更新时间:2023-12-04 19:24:14 36 4
gpt4 key购买 nike

在安装 node_modules 时,我使用了 --legacy-peer-deps--force 标志。这在我本地系统上的 Windows 上运行良好,但在 ubuntu 服务器上部署项目时不起作用!

这是我得到的错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @nestjs/mongoose@8.0.1
npm ERR! Found: mongoose@6.0.1
npm ERR! node_modules/mongoose
npm ERR! mongoose@"6.0.1" from the root project
npm ERR! mongoose@"*" from @types/mongoose@5.11.96
npm ERR! node_modules/@types/mongoose
npm ERR! dev @types/mongoose@"5.11.96" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer mongoose@"^5.11.15 || ^5.12.4" from @nestjs/mongoose@8.0.1
npm ERR! node_modules/@nestjs/mongoose
npm ERR!
npm ERR! Conflicting peer dependency: mongoose@5.13.14
npm ERR! node_modules/mongoose
npm ERR! peer mongoose@"^5.11.15 || ^5.12.4" from @nestjs/mongoose@8.0.1
npm ERR! node_modules/@nestjs/mongoose
npm ERR! @nestjs/mongoose@"8.0.1" 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.
npm ERR!
npm ERR! See C:\Users\Admin\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Local\npm-cache\_logs\2022-06-14T08_44_12_502Z-debug-0.log

最佳答案

这意味着你有依赖冲突。因此,尝试一个一个地运行以下选项。

  1. 删除node_modulespackage-lock.json然后运行

    npm install
  2. 或者尝试清除 npm 缓存

    npm cache clean --force
  3. 或者使用 --legacy-peer-deps 选项运行命令

    npm install --legacy-peer-deps
  4. 或者使用--force选项运行命令

    npm install --force

关于node.js - 错误!代码 ERESOLVE npm ERR! ERESOLVE 无法解析 npm ERR!在解析 : @nestjs/mongoose@8. 0.1 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72614420/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com