1.配置idea的npm
2.点击运行按钮
3.结果
分析原因及问题:
npm i
npm run dev
由于是刚刚从gitlab新拉的前端代码,可能没有用命令install过类似于没有编译过,所以执行一下上面的命令
结果报错如下:
F:\tbyf\qjyy\hip-manager-ui>npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: his@9.0.1
npm ERR! Found: webpack@5.93.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from compression-webpack-plugin@5.0.2
npm ERR! node_modules/compression-webpack-plugin
npm ERR! dev compression-webpack-plugin@"5.0.2" from the root project
npm ERR! peer webpack@"^5.0.0" from filemanager-webpack-plugin@8.0.0
npm ERR! node_modules/filemanager-webpack-plugin
npm ERR! filemanager-webpack-plugin@"^8.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! less-loader@"^5.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@4.47.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from less-loader@5.0.0
npm ERR! node_modules/less-loader
npm ERR! less-loader@"^5.0.0" 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 D:\program\nvm\node_cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\program\nvm\node_cache\_logs\2024-08-09T08_10_12_997Z-debug-0.log
根据提示:使用命令npm i --legacy-peer-deps
最终就npm i成功了
让我们点击自己配置的dev启动一下
最后问题解决了,启动成功
总结:遇到问题不用慌,先看报错分析分析问题是什么,分析不出来可以像上面一样看看 报错日志有没有提示操作的信息。