当先锋百科网

首页 1 2 3 4 5 6 7
[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function
    at WebpackCLI.makeCommand (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\lib\webpack-cli.js:173:21)
    at ServeCommand.apply (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\node_modules\@webpack-cli\serve\lib\index.js:41:19)
    at loadCommandByName (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\lib\webpack-cli.js:907:35)
    at async Command.<anonymous> (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\lib\webpack-cli.js:1462:17)
    at async Promise.all (index 0)
    at async WebpackCLI.run (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\lib\webpack-cli.js:1500:9)
    at async runCLI (C:\Users\000\Desktop\row-color\node_modules\webpack-cli\lib\bootstrap.js:11:9)

1 . 先查看webpack版本

npx webpack --version

webpack 5.42.1
webpack-cli 4.7.2
webpack-dev-server 3.11.2

2 .把webpack-cli  升级到4.10.0以上  解决问题

npm i [email protected] -D