Webpack-dev-server: Too many arguments provided

Created on 10 Jul 2017  Â·  10Comments  Â·  Source: webpack/webpack-dev-server

Looks like latest changes in 2.5.1 introduced a bug

> webpack-dev-server --progress

YError: Too many arguments provided. Expected max 2 but received 3.
    at module.exports (.../node_modules/yargs/lib/argsert.js:31:13)
    at Object.Yargs.self.alias (.../node_modules/yargs/yargs.js:245:5)
    at module.exports (.../node_modules/webpack/bin/config-yargs.js:12:4)
    at Object.<anonymous> (.../node_modules/webpack-dev-server/bin/webpack-dev-server.js:49:36)

MacOS 10.12.5
webpack v3.1.0
webpack-dev-server v2.5.1

v2.5.0 works fine

Most helpful comment

This seems to be the line causing the problem:
alias("help", "h", "?")

https://github.com/webpack/webpack/blob/master/bin/config-yargs.js#L12

All 10 comments

I can confirm this; getting the exact same error.

Using:

webpack v3.1.0
webpack-dev-server v2.5.1

Confirmed with

webpack v3.2.0
webpack-dev-server v2.5.1

The following works:

webpack v3.2.0
webpack-dev-server v2.5.0

I'm replicating this error with the following two lines of code:

const yargs = require("yargs");
require("webpack/bin/config-yargs")(yargs);

name | version
--- | ---
MacOS | 10.12.5
Node | v8.1.3
Npm | 5.0.3

package.json

  "dependencies": {
    "shelljs": "^0.7.8",
    "yargs": "^8.0.2"
  },
  "devDependencies": {
    "webpack": "^3.2.0"
  }

package.lock: https://pastebin.com/twDM8rDX

Trying to write my own command line tool using webpack-dev-server's code for inspiration when I hit upon the same error.

Anyone have any idea how to fix it?

This seems to be the line causing the problem:
alias("help", "h", "?")

https://github.com/webpack/webpack/blob/master/bin/config-yargs.js#L12

Updated node to 8.5.0. This error "YError: Too many arguments provided. Expected max 2 but received 3." came out. Revert back to 8.4.0 Everything went fine.

I'm getting the same error after upgrading to Node 8.5.0. Reverting to Node 8.4.0 does not fix it for me. The error seems to be related to the hot reload functionality; when the error is present, webpack-dev-server serves the files and watch/rebuilds correctly, but the hot reload URL that gets polled is a 404.

EDIT: Upgrading to Webpack 3.5.6 fixed this for me

the same error

➜  webpack-dev-server --version
webpack-dev-server 2.8.1
webpack 3.5.6
node 8.5

@huangyanxiong01 you might need to delete the "node_modules" and "package-lock.json" and trying again. Works fine for me with your versions.

Downgrade yargs to 6.0.4

This seems to be the line causing the problem:
alias("help", "h", "?")

https://github.com/webpack/webpack/blob/master/bin/config-yargs.js#L12

I have the same reason, and same error. The url you attached is not working though. any new updates regarding this ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gimmi picture gimmi  Â·  3Comments

tulika21-zz picture tulika21-zz  Â·  3Comments

mischkl picture mischkl  Â·  3Comments

Ky6uk picture Ky6uk  Â·  3Comments

daryn-k picture daryn-k  Â·  3Comments