webpack-cli无法加载'@webpack-cli/serve'命令webpack-cli typeError:devserverflags不是Itable Windows

发布于 2025-01-27 01:31:33 字数 2582 浏览 1 评论 0原文

我是极端新的,只是意识到Webpack是/在做什么,但我仍然无法在课程中运行它。这是错误

> dev
> webpack serve --config ./bundler/webpack.dev.js

[webpack-cli] Unable to load '@webpack-cli/serve' command
    [webpack-cli] TypeError: devServerFlags is not iterable
        at C:\Users\Gamer\code\threejs-dc-1\node_modules\@webpack-cli\serve\lib\index.js:28:43
        at WebpackCLI.makeCommand (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:104:31)
        at ServeCommand.apply (C:\Users\Gamer\code\threejs-dc-1\node_modules\@webpack-cli\serve\lib\index.js:10:19)
        at loadCommandByName (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:626:35)
        at Command.<anonymous> (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:1091:23)
        at Command.listener [as _actionHandler] (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:922:31)
        at Command._parseCommand (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1503:14)
        at Command.parse (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1292:10)
        at Command.parseAsync (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1318:10)
        at WebpackCLI.run (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:1123:28)

,这是我的软件包。JSON

{
  "repository": "#",
  "license": "UNLICENSED",
  "scripts": {
    "build": "webpack --config ./bundler/webpack.prod.js",
    "dev": "webpack serve --config ./bundler/webpack.dev.js"
  },
  "dependencies": {
    "@babel/core": "^7.13.1",
    "@babel/preset-env": "^7.13.5",
    "babel-loader": "^8.2.2",
    "clean-webpack-plugin": "^3.0.0",
    "copy-webpack-plugin": "^7.0.0",
    "css-loader": "^5.1.0",
    "dat.gui": "^0.7.7",
    "file-loader": "^6.2.0",
    "html-loader": "^2.1.1",
    "html-webpack-plugin": "^5.2.0",
    "mini-css-extract-plugin": "^1.3.9",
    "portfinder-sync": "0.0.2",
    "raw-loader": "^4.0.2",
    "style-loader": "^2.0.0",
    "three": "^0.126.0",
    "webpack": "^5.24.2",
    "webpack-cli": "^4.5.0",
    "webpack-dev-server": "^4.9.0",
    "webpack-merge": "^5.7.3"
  }
}

我正在运行以下内容:

webpack: 5.72.0
webpack-cli: 4.9.2
webpack-dev-server 4.9.0
node v16.15.0
npm 8.5.5

在Windows 10上。

我已卸载(完全)节点V18和NPM并重新安装。我已经卸载了WebPack并重新安装。我不知所措。任何帮助都将受到赞赏!我什至还没有上课,但是我肯定会学习一堂课!

Diza

I am extreme newb and just realized what webpack was/is doing but I still can not get it to run in my lesson. Here is the error

> dev
> webpack serve --config ./bundler/webpack.dev.js

[webpack-cli] Unable to load '@webpack-cli/serve' command
    [webpack-cli] TypeError: devServerFlags is not iterable
        at C:\Users\Gamer\code\threejs-dc-1\node_modules\@webpack-cli\serve\lib\index.js:28:43
        at WebpackCLI.makeCommand (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:104:31)
        at ServeCommand.apply (C:\Users\Gamer\code\threejs-dc-1\node_modules\@webpack-cli\serve\lib\index.js:10:19)
        at loadCommandByName (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:626:35)
        at Command.<anonymous> (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:1091:23)
        at Command.listener [as _actionHandler] (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:922:31)
        at Command._parseCommand (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1503:14)
        at Command.parse (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1292:10)
        at Command.parseAsync (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\node_modules\commander\index.js:1318:10)
        at WebpackCLI.run (C:\Users\Gamer\code\threejs-dc-1\node_modules\webpack-cli\lib\webpack-cli.js:1123:28)

and here is my package.json

{
  "repository": "#",
  "license": "UNLICENSED",
  "scripts": {
    "build": "webpack --config ./bundler/webpack.prod.js",
    "dev": "webpack serve --config ./bundler/webpack.dev.js"
  },
  "dependencies": {
    "@babel/core": "^7.13.1",
    "@babel/preset-env": "^7.13.5",
    "babel-loader": "^8.2.2",
    "clean-webpack-plugin": "^3.0.0",
    "copy-webpack-plugin": "^7.0.0",
    "css-loader": "^5.1.0",
    "dat.gui": "^0.7.7",
    "file-loader": "^6.2.0",
    "html-loader": "^2.1.1",
    "html-webpack-plugin": "^5.2.0",
    "mini-css-extract-plugin": "^1.3.9",
    "portfinder-sync": "0.0.2",
    "raw-loader": "^4.0.2",
    "style-loader": "^2.0.0",
    "three": "^0.126.0",
    "webpack": "^5.24.2",
    "webpack-cli": "^4.5.0",
    "webpack-dev-server": "^4.9.0",
    "webpack-merge": "^5.7.3"
  }
}

I am running the following:

webpack: 5.72.0
webpack-cli: 4.9.2
webpack-dev-server 4.9.0
node v16.15.0
npm 8.5.5

on Windows 10.

I have uninstalled (fully) node v18 and npm and reinstalled. I've uninstalled webpack and reinstalled. I am at a loss. Any help is appreciated! I haven't even gotten started on my lesson but I am learning a lesson for sure!

Diza

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文