如何解決npm i下載依賴的時(shí)候出現(xiàn)某依賴版本沖突
npm i 下載依賴的時(shí)候出現(xiàn)某依賴版本沖突
npm i 下載依賴的時(shí)候出現(xiàn)了報(bào)錯(cuò),大概就是版本的問(wèn)題
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @wangeditor/editor-for-vue@1.0.2
npm ERR! Found: @wangeditor/editor@5.0.1
npm ERR! node_modules/@wangeditor/editor
npm ERR! @wangeditor/editor@"5.0.1" from the root project
npm ERR! peer @wangeditor/editor@">=5.0.0" from @wangeditor/plugin-formula@1.0.11
npm ERR! node_modules/@wangeditor/plugin-formula
npm ERR! @wangeditor/plugin-formula@"^1.0.8" from the root project
npm ERR! 1 more (@wangeditor/plugin-mention)
npm ERR!
解決方法
在npm install 后面加 --legacy-peer-deps,就可以解決了
npm i --legacy-peer-deps
其實(shí)這個(gè)命令的本身含義就在于讓其下載依賴的時(shí)候去忽略 依賴間 帶來(lái)的沖突 (這是我個(gè)人的理解哈!)
npm下載報(bào)錯(cuò)npm ERR code ERESOLVE
報(bào)錯(cuò):
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! peer eslint-plugin-vue@"^8.0.1" from @vue/eslint-config-typescript@9.1.0
npm ERR! node_modules/@vue/eslint-config-typescript
npm ERR! dev @vue/eslint-config-typescript@"^9.1.0" from the root project
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! Conflicting peer dependency: eslint-plugin-vue@7.20.0
t 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\danxibao\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\danxibao\AppData\Local\npm-cache\_logs\2022-05-29T07_02_09_565Z-debug-0.log
解決:
- npm下載時(shí)
- --legacy-peer-deps
- 在NPM v7中,現(xiàn)在默認(rèn)安裝peerDependencies。
在很多情況下,npm版本問(wèn)題會(huì)導(dǎo)致下載沖突,從而中斷安裝過(guò)程。
–legacy-peer-deps標(biāo)志是在v7中引入的,目的是繞過(guò)peerDependency自動(dòng)安裝;
它告訴 NPM 忽略項(xiàng)目中引入的各個(gè)modules之間的相同modules但不同版本的問(wèn)題并繼續(xù)安裝,保證各個(gè)引入的依賴之間對(duì)自身所使用的不同版本modules共存。
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
vue打包部署到springboot的實(shí)現(xiàn)示例
項(xiàng)目開發(fā)中,一般我們都會(huì)使用SpringBoot+Vue進(jìn)行前后端開發(fā),本文主要介紹了vue打包部署到springboot的實(shí)現(xiàn)示例,具有一定的參考價(jià)值,感興趣的可以了解一下2024-07-07Vue?Steam同款登錄驗(yàn)證數(shù)字輸入框功能
這篇文章主要介紹了Vue?Steam同款登錄驗(yàn)證數(shù)字輸入框功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2024-03-03詳解vue-flickity的fullScreen功能實(shí)現(xiàn)
這篇文章主要介紹了詳解vue-flickity的fullScreen功能實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04Vue3使用v-if指令進(jìn)行條件渲染的實(shí)例代碼
條件渲染是根據(jù)條件的真假來(lái)有條件地渲染元素,在Vue.js 3.x中,常見(jiàn)的條件渲染包括使用v-if指令和v-show指令,本文講解使用v-if指令進(jìn)行條件渲染,需要的朋友可以參考下2024-03-03Vue3中的極致防抖/節(jié)流詳解(附常見(jiàn)方式防抖/節(jié)流)
在JavaScript中函數(shù)的防抖和節(jié)流不是什么新鮮話題,這篇文章主要給大家介紹了關(guān)于Vue3中極致防抖/節(jié)流的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-02-02vue項(xiàng)目配置eslint保存自動(dòng)格式化問(wèn)題
這篇文章主要介紹了vue項(xiàng)目配置eslint保存自動(dòng)格式化問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09