在维护别人的项目的时候,git克隆项目后,运行
npm install
的时候,出现下面的错误:
//报错信息:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vue-wechat-auth@2.0.0
npm ERR! Found: vue@2.6.12
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"3.0.11" from @vue/compiler-sfc@3.0.11
npm ERR! node_modules/@vue/compiler-sfc
npm ERR! peer @vue/compiler-sfc@"^3.0.0-beta.14" from @vue/cli-service@4.5.12
npm ERR! node_modules/@vue/cli-service
npm ERR! dev @vue/cli-service@"~4.5.0" from the root project
npm ERR! 1 more (@vue/cli-plugin-babel)
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\Oct1a\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\Oct1a\AppData\Local\npm-cache_logs\2021-04-26T08_57_47_739Z-debug.log
上面的错误大致看了一下,是无法解决依赖问题,我猜想应该是
node版本
造成的,所以升级或者降级自己的node版本
,然后重新安装依赖包,但是这样比较麻烦,在进行查询时,发现别人使用的这个命令就挺好,不用更换node版本
,就可以npm install
。
npm i --legacy-peer-deps
2.如果报错的信息如下:(和python等有关的时候)
You need to install the latest version of Visual Studio npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload. npm ERR! gyp ERR! find VS For more information consult the documentation at: npm ERR! gyp ERR! find VS github.com/nodejs/node…
可以使用
nvm
将node
的版本降低至12.16.0
版本之后再install
然后进行运行