電腦npm install
報錯; 報錯日志如下:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" 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\AB123\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\AB123\AppData\Local\npm-cache\_logs\2023-01-24T03_08_49_805Z-debug-0.log
上述報錯日志中有個關(guān)鍵字眼:this command with --force, or --legacy-peer-deps
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:何時使用--force
和--legacy-peer-deps
?--force
會無視沖突,并強(qiáng)制獲取遠(yuǎn)端npm
庫資源,即使本地有資源也會覆蓋掉--legacy-peer-deps
:安裝時忽略所有peerDependencies
,忽視依賴沖突,已有的依賴不會覆蓋,。
建議用--legacy-peer-deps
比較保險一點(diǎn),反正我用了就安裝成功了;文章來源:http://www.zghlxwxcb.cn/news/detail-542434.html
比如原本的命令為 npm i vuex-persistedstate 。改為npm i vuex-persistedstate --legacy-peer-deps即可。其余同樣如此文章來源地址http://www.zghlxwxcb.cn/news/detail-542434.html
到了這里,關(guān)于npm install:Could not resolve dependency:peer... 原因和解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!