簡體   English   中英

npm 錯誤! 代碼 ERESOLVE npm 錯誤! ERESOLVE 無法解析 npm ERR! 解決時:@nestjs/mongoose@8.0.1

[英]npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! While resolving: @nestjs/mongoose@8.0.1

在安裝 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM