问题遇到的现象和发生背景
刚从git上面拉下来的代码,我需要跑起来 代码拿到vscoed 命令行输入 npm install 后报错
问题相关代码,请勿粘贴截图
运行 npm install 报错如下
npm ERR! code ERESOLVE
npm ERR!
npm ERR! While resolving: relytosoft.lms@1.0.0
npm ERR! Found: html-webpack-plugin@4.0.0-alpha
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin@"4.0.0-alpha" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! node_modules/script-ext-html-webpack-plugin
npm ERR! dev script-ext-html-webpack-plugin@"2.0.1" 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!
npm ERR! See F:\Program\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! F:\Program_logs\2022-08-30T08_07_46_509Z-debug-0.log
运行结果及报错内容
运行 npm install 报错如下
npm ERR! code ERESOLVE
npm ERR!
npm ERR! While resolving: relytosoft.lms@1.0.0
npm ERR! Found: html-webpack-plugin@4.0.0-alpha
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin@"4.0.0-alpha" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! node_modules/script-ext-html-webpack-plugin
npm ERR! dev script-ext-html-webpack-plugin@"2.0.1" 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!
npm ERR! See F:\Program\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! F:\Program_logs\2022-08-30T08_07_46_509Z-debug-0.log
我的解答思路和尝试过的方法
按照你的方法 npm install -g cnpm --registry=http://registry.npm.taobao.org/
安装完之后可以通过cnpm -v 检验后报错 (红色的)
cnpm : 无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
- cnpm -v
- CategoryInfo : ObjectNotFound: (cnpm:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
我想要达到的结果
代码能运行起来