美文网首页
Vite 有两个版本时,安装依赖报错

Vite 有两个版本时,安装依赖报错

作者: 伊路顺峰 | 来源:发表于2022-08-25 20:58 被阅读0次

    安装依赖是报错如下:

    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 还是报错,最后发现是版本问题,安装指定版本正确安装,在npm 上找到一个1.8.2 ,安装成功

     npm install @vitejs/plugin-legacy@1.8.2 terser -D
    

    相关文章

      网友评论

          本文标题:Vite 有两个版本时,安装依赖报错

          本文链接:https://www.haomeiwen.com/subject/fmyzgrtx.html