-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server can't be accessed via IP #147
Comments
1.8.0 appears to be defaulting to "localhost' now. You can open it up by passing the --host option. |
Ahh. Good to know. Thanks! |
thanks。 |
1 similar comment
thanks。 |
If you're using WebpackDevServer, be aware that the host argument is part of
|
thanks |
1 similar comment
thanks |
How did I use express to do? var devMiddleware = require('webpack-dev-middleware')(compiler, {
publicPath: webpackConfig.output.publicPath,
hot: true,
stats: {
colors: true,
chunks: false
}
})
// use express
app.use(devMiddleware)
app.listen(port, host, function (err) {
if (err) {
console.log(err)
return
}
console.log('Listening at ' + host + ':' + port + '\n')
}) It didn't work! |
thanks a lot! |
@honger05 It'm not sure where the host and port are being set in your code, but you would want to make sure host is set to '0.0.0.0' instead of 'localhost'. |
It can also be set from the webpack file by setting devServer: {
host: '0.0.0.0',
port: 8080,
...
} |
oh my god |
I turn on the |
@anchengjian Here are some piece code of my server.js
In listen function ,the second param set '0.0.0.0' , maybe can solve this problom. |
@caisah good to know.ths |
I had to do the following to get mine to work with the help from @pdillon and his comment I have Windows 7 so I did
Then went up to LAN and found the ipv4 address
So I edited my npm run start command to be
I was then able to access the content that is being served on
Will be available as the web on another computer by going to
In the web browsers URL field on the other computer that was connected to the same wifi network |
just FYI, you can just type |
@honger05 Add host: '0.0.0.0' to your devMiddleware config, just like below, it works to me.
|
Using |
the hardcoded IP wouldn't work for me @peacechen - I was able to get mine to work by disabling
|
Webpack does not support to access `localhost` of `devServer` from a VM. Solution is described here: webpack/webpack-dev-server#147 (comment)
pdillon ... you are the man!! Thanks a bunch |
@erikyuzwa thanks |
goodness, thanks |
Is there a way to dynamically generate the |
Thanks @pdillon, just got gatsby
|
thanks |
For anyone who are using vue webpack template, this issue can be solved by config the module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false
}
// ... ... other config ignored here
} |
Its working for me thanks |
@anchengjian Use |
Perhaps it's worth to point out that in order to access the webpack-dev-server from other devices on your local network you need to pass See #882. Maybe add this to the top of this thread if possible? |
how to change with the create-react-app and express code ,it didn't work. i don't know which file to be change . |
By allowing "host" to be specified for the DevServer of a WebPack config, it can be set to "0.0.0.0" to allow access from other computers on the network. See, for example, the discussion here: webpack/webpack-dev-server#147. Another solution could be to expose the arguments created in KotlinWebpackRunner.kt. However, such a solution would be more invasive.
In
1.7.0
the following command:would allow the server to be accessed at:
http://localhost:3000
andhttp://10.0.1.4:3000
(my local IP).In
1.8.0
accessinghttp://10.0.1.4:3000
no longer works.Not sure if this has to do with
webpack-dev-server
or one of the dependencies.I'm using node
0.12.2
and running OSX10.10.2
The text was updated successfully, but these errors were encountered: