Webpack-dev-server: TypeError: this.hostname.indexOf is not a function

Created on 20 Sep 2017  路  6Comments  路  Source: webpack/webpack-dev-server

  • Operating System: Windows7
  • Node Version: 6.10.0
  • NPM Version: 5.3.0
  • webpack Version: 3.5.3
  • webpack-dev-server Version: 2.8.2

  • [ ] This is a feature request

  • [x] This is a bug

devServer config

    devServer: {
        host: '0.0.0.0',
        useLocalIp: true,
        open: true,
        openPage: "",
        proxy: {
            "*": {
                target: 'http://localhost:10011/',
                secure: false
            }
        }
    }

the error report

image

I found this at version 2.8.2 and then found webpack-dev-server version > 2.7.1 have this problem.

Now, I rollback to 2.7.1 , it works fine.

2 (regression) bug

Most helpful comment

This is another errant package update from the cleanup effort I'm afraid. We definitely need some better testing around the different options. I'll push a commit to change the internal-ip dependency back to 1.2.0, which is the module update that broke this option.

All 6 comments

@penggy what's the command you're using to launch webpack-dev-server from the command line?

@shellscape the command is

npm run start

the script in package.json is

"start": "cross-env NODE_ENV=development webpack-dev-server"

if set useLocalIp: false error info disappear

This is another errant package update from the cleanup effort I'm afraid. We definitely need some better testing around the different options. I'll push a commit to change the internal-ip dependency back to 1.2.0, which is the module update that broke this option.

In version 1.2.0, internalIp.v4() was returning the ip.
In version 2.0.0, internalIp.v4() returns a Promise. That's not the same at all.

It fails during: const hostname = options.useLocalIp ? internalIp.v4() : options.host; in createDomain.js.

Is it possible to publish the version with the fix (rollback to 1.2.0 or correction of the Promise management)

@paztis much appreciate the extra hand there, but per previous comments and the referenced commit in the issue, we identified the issue with this and there has been a commit pushed. versions are released when we're able to. please feel free to reference the git repo directly in your package.json in the meantime

@infantito please avoid posting "me too" or "same" replies on an issue, especially once it's been addressed. instead, you can add reactions to the original post for the issue https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daryn-k picture daryn-k  路  3Comments

uMaxmaxmaximus picture uMaxmaxmaximus  路  3Comments

subblue picture subblue  路  3Comments

gimmi picture gimmi  路  3Comments

eyakcn picture eyakcn  路  3Comments