Vite 有兩個版本時,安裝依賴報錯

安裝依賴是報錯如下:

npm install @vitejs/plugin-legacy terser -D
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: forum_web@0.0.0
npm ERR! Found: vite@2.9.15
npm ERR! node_modules/vite
npm ERR!   dev vite@"^2.8.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0" from @vitejs/plugin-legacy@2.0.1
npm ERR! node_modules/@vitejs/plugin-legacy
npm ERR!   dev @vitejs/plugin-legacy@"*" 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 /Users/wf/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wf/.npm/_logs/2022-08-25T12_40_23_352Z-debug-0.log

刪掉node_models 重新 npm install 還是報錯,最后發(fā)現(xiàn)是版本問題,安裝指定版本正確安裝,在npm 上找到一個1.8.2 ,安裝成功

 npm install @vitejs/plugin-legacy@1.8.2 terser -D
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容