webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

Anyone here got webpack-dev-server to work on Cloud 9?

Open YarivGilad opened this issue 11 years ago • 30 comments

Hi, since webpack-dev-server has a dependency on node-gyp ( see issue #229 ) we tried using it with cloud 9 which runs an online editor on a Linux machine. The installations of webpack-dev-server on cloud 9 goes smoothly but requests to it were not successful. I suspect it has something to do with a different networking paradigm. All the tutorials I've found on webpack-dev-server show the index.html will have a script tag with the source of the output bundle.js coming from the webpack-dev-server at localhost:8080 which is the default... when you run on your local machine it make sense to access the server via localhost, but when you run the webpack-dev-server on cloud 9 it should be something else. a normal express app could be accessible via their scheme - https:// + your username + / + your workspace name - serving as if you would run localhost, so I tried that scheme and it didn't work, I tried using 0.0.0.0:8080 and it didn't work. I also noticed that c9 runs on https and the webpack-dev-server must assume plain http when communicating with the client via socket.io... In short - I'd appreciate any help from someone who managed to get the webpack-dev-server to run on c9... Thanks Ajar

YarivGilad avatar Jul 31 '15 05:07 YarivGilad

webpack-dev-server --history-api-fallback --inline --progress --public myproject.c9users.io --host $IP --port $PORT
``` worked for me

nagarajasr avatar Jul 21 '17 17:07 nagarajasr

Thank you @adleviton ! That worked for me.

auz1111 avatar Jul 28 '17 16:07 auz1111

Adding this --host $IP --port $PORT --public $C9_HOSTNAME after this cross-env NODE_ENV=development webpack-dev-server --open --hot works fine for me with hot reloading.

ngustavo avatar Aug 01 '17 19:08 ngustavo

GET http://0.0.0.0:8080/packs/application.js net::ERR_EMPTY_RESPONSE It works on its own but not with Rails server running.

pelx avatar Aug 10 '17 16:08 pelx

webpack-dev-server --public your-project.c9users.io --host $IP --port $PORT --hot --inline --

x5engine avatar Jul 17 '18 06:07 x5engine

I struggled for so long until trying @x5engine's suggestions.

THANK YOU! I finally got it to work.

podenborg avatar Mar 18 '19 21:03 podenborg

If anyone comes across this, I wanted to share my solution because I know how frustrating this can be (for the new AWS Cloud 9):

EDIT (thanks @jakewatton95) { You'll need to add an inbound rule for port 8080 to your EC2 instance:

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Security Groups. Select the security group for your instance.

  3. Choose Inbound, Edit, Add Rule.

  4. Add 8080, and give it the name "dev-server"

}

Create a script in your package.json: "dev-server-c9": "webpack-dev-server --host 0.0.0.0 --port 8080"

Then open the terminal in AWS Cloud 9, and run the script: npm run dev-server-c9

The terminal should output "Project is running at http://0.0.0.0:8080/"

Just click on the address, and choose "open," it will open a new browser window pointing to the page.

Johnzy916 avatar Aug 02 '19 17:08 Johnzy916

@Johnzy916 Solution works, but you need to make sure you're allowing inbound connections on port 8080 from the IP that you are trying to see the page from.

jakewatton95 avatar Oct 16 '19 16:10 jakewatton95

Try below config and make sure to set https: false

devServer: { host: process.env.IP, public : "https://*****.vfs.cloud9.us-east-2.amazonaws.com", https: false, disableHostCheck: true, historyApiFallback: true, port: 8080, },

ppbntl19 avatar May 24 '20 05:05 ppbntl19

this is related to the glory days of c9, not the new weird aws c9

x5engine avatar May 24 '20 11:05 x5engine