quarks
quarks

Reputation: 35346

Node http-server not working on Windows 10 Ubuntu Bash

I just tried to install NodeJS http-server on Windows 10 Ubuntu Bash, installation worked fine but running it to serve a static site $http-server src throws this error:

$ http-server src

/usr/lib/node_modules/http-server/bin/http-server:14
var ifaces = os.networkInterfaces();
                ^
Error: EINVAL, invalid argument
    at Object.<anonymous> (/usr/lib/node_modules/http-server/bin/http-server:14:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:945:3

What can be missing here? Not supported yet with Ubuntu bash on Windows 10?

Upvotes: 10

Views: 5503

Answers (1)

Silveri
Silveri

Reputation: 5261

Update: This issue has been fixed since the Windows 10 Creators Update (April 2017).

This is currently a known issue[1][2][3][4] with regards to some low-level networking code that has not yet been implemented for Bash on Windows or the Windows-Linux Subsystem (WSL).

Until it is fixed, you can try using live-server:

sudo npm install live-server -g
live-server src

or possibly Python's SimpleHTTPServer:

cd src
python -m SimpleHTTPServer 8000

To help fix it sooner, it is suggested that you vote for the issue on the Bash on Windows Uservoice site as Microsoft will be using those votes to determine which issues to prioritize for fixing in any upcoming updates.

Upvotes: 13

Related Questions