我已经下载了webpack-cli了,但是依然报错。蒙蔽了D:\web\products\webpackTest2>webpack-cli-v2.0.10D:\web\products\webpackTest2>webpack-dev-server-vTheCLImovedintoaseparatepackage:webpack-cli.Pleaseinstall'webpack-cli'inadditiontowebpackitselftousetheCLI.->Whenusingnpm:npminstallwebpack-cli-D->Whenusingyarn:yarnaddwebpack-cli-Dmodule.js:540throwerr;^Error:Cannotfindmodule'webpack-cli/bin/config-yargs'atFunction.Module._resolveFilename(module.js:538:15)atFunction.Module._load(module.js:468:25)atModule.require(module.js:587:17)atrequire(internal/module.js:11:18)atObject.(D:\web\products\webpackTest2\node_modules\_webpack-dev-server@3.1.0@webpack-dev-server\bin\webpack-dev-server.js:65:1)atModule._compile(module.js:643:30)atObject.Module._extensions..js(module.js:654:10)atModule.load(module.js:556:32)attryModuleLoad(module.js:499:12)atFunction.Module._load(module.js:491:3)
2 回答
RISEBY
TA贡献1856条经验 获得超5个赞
遇到过一样的问题,不知道你是否也用的webpack4?我的解决方法是在config配置文件中加入配置:mode:'development'或者mode:'production'module.exports={//其他参数mode:'development',devServer:{//其他配置}}mode是webpack4新增配置项。你可以试试。命令行加参数--modedevelopment或--modeproduction应该也可以。
森栏
TA贡献1810条经验 获得超5个赞
itneedstobeinstalledalongsidewebpacktousetheCLIwebpack-cli需要和webpack同时安装才能生效。记住!!同时安装yarnaddwebpack-cliwebpack-D
添加回答
举报
0/150
提交
取消