[英]Could not resolve dependency: npm ERR! peer webpack@"^4.0.0" from uglifyjs-webpack-plugin@2.2.0
[英]Unresolved dependency peer webpack@"^4.0.0" from css-loader@2.1.1
我試圖運行一個反應項目。 已安裝 React 和 Node 版本:
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cbioportal-frontend@3.3.182
npm ERR! Found: webpack@5.55.1
npm ERR! node_modules/webpack
npm ERR! webpack@"^5.55.1" from the root project
npm ERR! peer webpack@"*" from bootstrap-loader@1.3.3
npm ERR! node_modules/bootstrap-loader
npm ERR! bootstrap-loader@"^1.2.0-beta.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from css-loader@2.1.1
npm ERR! node_modules/css-loader
npm ERR! css-loader@"^2.1.1" from the root project
npm ERR! peer css-loader@"*" from bootstrap-loader@1.3.3
npm ERR! node_modules/bootstrap-loader
npm ERR! bootstrap-loader@"^1.2.0-beta.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.```
根據錯誤消息, css-loader@^2.1.1"
和webpack@^4.0.0
之間存在依賴沖突。
嘗試npm uninstall --save-dev css-loader webpack
完全卸載依賴項。
然后使用npm install --save-dev css-loader webpack
重新安裝它們。
希望與最新版本不會有任何依賴沖突,但如果是這樣,請嘗試npm install --legacy-peer-deps
我試過這個,現在它對我有用,首先通過執行這個命令node -v
檢查節點上的版本,如果你沒有這個節點版本v12.22.12
通過執行這個命令nvm install 12.22.12
然后安裝它僅通過執行此命令來使用此節點nvm use 12.22.12
然后重新啟動終端(關閉所有終端)然后啟動
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.