The networkInterfaces function in the "os" API of node.js does not work under "bash on windows"
- A brief description With the lastest version of node.js installed (currently 4.5) the os.networkInterfaces method throws an exception: invalid argument, uv_interface_addresses
- Your Windows build number 14393
Thanks for reporting the issue. Could you please share out a strace of the failure so we can see if there is a system call failure?
Very likely same reason /sbin/ifconfig fails
Thanks @choclaudio for reporting this! It sounds to me like a duplicate of #468; in particular, this comment notes the same error text that you have identified.
There's a bunch of discussion on that ticket, including a workaround posted by @therealkenc here. You could try that workaround to see if it helps you out.
Hi everyone!
Yes, it seems to me that it is a duplicate of #468 and ericblades comment seems reasonable.
Here follows the full stack-trace from console:
Error: EINVAL: invalid argument, uv_interface_addresses
at Error (native)
at /usr/lib/node_modules/ember-cli/node_modules/portfinder/lib/portfinder.js:395:23
at Object.
I checked the portfinder.js code and tracked it to the "os" api of node.js, since this is the native part of nodejs I did not follow it further and @ericblade is probably right.
If someone knows how to properly verify that it is the ifconfig issue then both this and #468 cloud be removed/merged into the root-cause.
I almost forgot, I also did a test running this code directly with node:
const os = require('os'); console.log(os.networkInterfaces());
The stacktrace for that:
Error: EINVAL: invalid argument, uv_interface_addresses
at Error (native)
at Object.
Checking the node.js source code: https://github.com/nodejs/node/blob/master/src/node_os.cc
Method: static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args)
contains this particular code:
int err = uv_interface_addresses(&interfaces, &count);
ret = Object::New(env->isolate());
if (err == UV_ENOSYS) {
return args.GetReturnValue().Set(ret);
} else if (err) {
return env->ThrowUVException(err, "uv_interface_addresses");
}
As far as I understand node.js relies on libuv for these operations, you can find the "uv_interface_addresses" there (http://docs.libuv.org/en/v1.x/misc.html).
The source code for the method can be found here: https://github.com/libuv/libuv/blob/7a19a48df8/src/unix/linux-core.c#L741
It is clear from this source code that it extensivly uses ifconfig information hence again strengthening the case made by @ericblade
These are some related comments: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13383789-enable-network-interface-enumeraration
Some news? 😞
Nope, after my initial investigation into the issue I have not received any further feedback, not even on my actual findings.
There are a lot of issues about this question since april.
It's unbelievable the problem doesn't have been resolved.
Looks like this may be being worked on.
https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13383789-enable-network-interface-enumeraration
@JasonLinMS as FYI.
@cjibo Yes, it is being worked on. But, no ETA at the moment.
@sunilmut Any update on when this might be fixed? Currently I need to work around this using dirty hacks :(
@saschagehlich Should be this week for the Insider fast ring. I'll let you know if there are any changes to the schedule from the release team.
Just an update that 'ifconfig' and the 'ip' commands for network enumeration should be working in the latest fast insider build 14965, also see release notes
Closing this out since this has been marked fixed for sometime. If the issue persists, please reopen.