最近在分析开源项目vue,运行前端部分项目时,npm install遇到了bug
之前在其他项目中运行npm install都不存在该问题;node 版本冲突导致 重新更新版本即可
s\npm\bin\npm-cli.js install --scripts-prepend-node-path=auto
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @babel/core@7.0.0
npm ERR! node_modules/@babel/core
npm ERR! dev @babel/core@"7.0.0" from the root project
npm ERR! peer @babel/core@"^7.0.0-0" from @babel/register@7.0.0
npm ERR! node_modules/@babel/register
npm ERR! dev @babel/register@"7.0.0" from the root project
npm ERR! 62 more (@vue/cli-plugin-babel, babel-core, babel-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @babel/core@"^7.4.0-0" from @babel/helper-define-polyfill-provider@0.3.2
npm ERR! node_modules/babel-plugin-polyfill-corejs2/node_modules/@babel/helper-define-polyfill-provider
npm ERR! @babel/helper-define-polyfill-provider@"^0.3.2" from babel-plugin-polyfill-corejs2@0.3.2
npm ERR! node_modules/babel-plugin-polyfill-corejs2
npm ERR! babel-plugin-polyfill-corejs2@"^0.3.2" from @babel/plugin-transform-runtime@7.18.10
npm ERR! node_modules/@babel/plugin-transform-runtime
npm ERR! @babel/plugin-transform-runtime@"^7.4.0" from @vue/babel-preset-app@3.12.1
npm ERR! node_modules/@vue/babel-preset-app
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 \node_cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! \Nodejs\node_cache\_logs\2022-08-04T01_17_30_442Z-debug.log
Process finished with exit code 1
然后更新项目包
这样子重新启动项目就可以啦