Skip to content
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

os.networkInterfaces error in NodeJS / Yeoman #468

Closed
StfBauer opened this issue Jun 2, 2016 · 163 comments
Closed

os.networkInterfaces error in NodeJS / Yeoman #468

StfBauer opened this issue Jun 2, 2016 · 163 comments

Comments

@StfBauer
Copy link

StfBauer commented Jun 2, 2016

I managed to successfully install NodeJS, NPM and Yeoman. You see all installed components in the version below.

screen shot 2016-06-03 at 00 24 33

When create a new project and type.
yo <generator-name>
Everything works fine. A problem happens when I just try yo. Because Yeoman somehow tries to access the network interfaces of the operation system propably. This won't work on BashOnWindows because there is no network interface directly included in the Linux Sub System and just use the same network as the host one.
screen shot 2016-06-03 at 00 43 44

Am I completely wrong or can this be fixed in future releases? Thanx.

@sunilmut
Copy link
Member

sunilmut commented Jun 2, 2016

@StfBauer - If you can grab a strace of the failing command 'yo', we can see where it is failing and if it is tripping on something that is currently unimplemented. Thanks for trying out WSL!

@StfBauer
Copy link
Author

StfBauer commented Jun 3, 2016

@sunilmut Thank you. Attached the strace to this comment. Hope you find something useful.

Thanx for your great work so far. Love this.

yeoman-error.txt

@sunilmut
Copy link
Member

sunilmut commented Jun 3, 2016

socket(PF_NETLINK, SOCK_RAW, 0) = -1 EINVAL (Invalid argument)
WSL currently does not support NETLINK sockets. We are using our user voice page to prioritize the things to implement next. Please feel free to up vote this relevant task.

@StfBauer
Copy link
Author

StfBauer commented Jun 3, 2016

@sunilmut Thank you for the update. This will be required for the new SharePoint Framework update released by Microsoft. Because it use Yeoman generator to extend SharePoint from Linux, MacOSX as well as Windows.
In this case it would be great to use it from Bash On Windows.
Will add a user voice.

@StfBauer
Copy link
Author

StfBauer commented Jun 4, 2016

Added entry to user voices:
https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/14605521-add-netlink-socket-support

@cadupedroni
Copy link

I had a similar problem when trying to run the ionic.

Error getting IPv4 address: Error: EINVAL: invalid argument, uv_interface_addresses (CLI v1.7.15)

@abhishek1214
Copy link

Has this been fixed?

@abhishek1214
Copy link

Cause i am facing the same issue here is my error log

[22:09:50] Requiring external module babel-core/register
/mnt/c/Users/abhis/WebProjects/emails/cts-report/node_modules/browser-sync/node_modules/dev-ip/lib/dev-ip.js:21
var networkInterfaces = require("os").networkInterfaces();
^

Error: EINVAL: invalid argument, uv_interface_addresses
at Error (native)
at getIp (/mnt/c/Users/abhis/WebProjects/emails/cts-report/node_modules/browser-sync/node_modules/dev-ip/lib/dev-ip.js:21:43)
at Object. (/mnt/c/Users/abhis/WebProjects/emails/cts-report/node_modules/browser-sync/lib/utils.js:4:38)
at Module._compile (module.js:541:32)
at Module._extensions..js (module.js:550:10)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
Error: [email protected] start: gulp
Exit status 1
at EventEmitter. (/usr/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/lifecycle.js:217:16)
at emitTwo (events.js:106:13)
at EventEmitter.emit (events.js:191:7)
at ChildProcess. (/usr/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/spawn.js:24:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

@nicole-ashley
Copy link

@StfBauer: I don't know for sure, but could the UserVoice suggestion you created be a duplicate of https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13383789-enable-network-interface-enumeraration?

@JWo1F
Copy link

JWo1F commented Jul 1, 2016

Hi! When it will be done? :)

@sunilmut
Copy link
Member

sunilmut commented Jul 5, 2016

We are looking into supporting NETLINK and RAW sockets. It's difficult to give any ETA at the moment.

@afdallah
Copy link

I'm also facing the same problem when i run gulp. Is there any solution?

@simonbuchan
Copy link

Just a note on current build 14393 this now gets to the bind call

socket(PF_NETLINK, SOCK_RAW, 0)         = 9
bind(9, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = -1 EINVAL (Invalid argument)

@nicole-ashley
Copy link

Woohoo, progress! Soon I'll be able to switch to WSL for my node apps

@simonknittel
Copy link

simonknittel commented Jul 31, 2016

Just wanna say, that BrowserSync propably fails because of the same reason:

/mnt/e/wsl/repos/static-site-generator/node_modules/dev-ip/lib/dev-ip.js:21
    var networkInterfaces = require("os").networkInterfaces();
                                          ^

Error: EINVAL: invalid argument, uv_interface_addresses
    at Error (native)
    at getIp (/mnt/e/wsl/repos/static-site-generator/node_modules/dev-ip/lib/dev-ip.js:21:43)
    at Object.<anonymous> (/mnt/e/wsl/repos/static-site-generator/node_modules/browser-sync/lib/utils.js:4:38)
    at Module._compile (module.js:541:32)
    at Module._extensions..js (module.js:550:10)
    at Object.require.extensions.(anonymous function) [as .js] (/mnt/e/wsl/repos/static-site-generator/node_modules/babel-register/lib/node.js:156:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/mnt/e/wsl/repos/static-site-generator/node_modules/browser-sync/lib/snippet.js:9:20)
    at Module._compile (module.js:541:32)
    at Module._extensions..js (module.js:550:10)
    at Object.require.extensions.(anonymous function) [as .js] (/mnt/e/wsl/repos/static-site-generator/node_modules/babel-register/lib/node.js:156:7)
    at Module.load (module.js:458:32)

Everything is up-to-date (Windows, BrowserSync, Node, ...)

@Codenator81
Copy link

@simonknittel Yes still not work for me.

@afdallah
Copy link

afdallah commented Aug 1, 2016

Same here, i've update to the recent build. still get this error
bash

@mikeesouth
Copy link

Any news on this? Any workaround? This is causing my webpack builds to fail.

@miladmostavi
Copy link

miladmostavi commented Aug 3, 2016

We do not need raw sockets, rather, just the ability to query what interfaces there are.. Any updates on this?

@abergs
Copy link
Contributor

abergs commented Aug 3, 2016

Yep, I'm watching this as well. Breaking for me with the package "node-sass".
Running "Bash on Ubuntu on Windows" in the Anniversary Update.

@aseering
Copy link
Contributor

aseering commented Aug 3, 2016

I've hit the issue with os.networkInterfaces(), and I've found a workaround (though it's ugly):

  • Look at the stack trace to determine what direct package is causing this issue. Note that it's probably not the package that you're trying to run; it's probably a dependency of that package. @StfBauer , it looks like your problem is in npmconf (same as me). @abhishek1214 @simonknittel @afdallah , it looks like all of you are hitting a problem in the dev-ip module.
  • Look inside ~/.npm/<packagename>/<version>/. (If multiple versions are available, you probably want to update all of them? Though for me there was only one version.) You should see a directory named package and a file named package.tgz
  • Look inside the directory named package; you should be able to find the exact .js file where the failure in your stack trace is occurring. Make a backup copy of that file somewhere so you can revert your changes if necessary.
  • Open that file in your favorite Linux text editor. Replace all calls to os.networkInterfaces(), require("os").networkInterfaces(), etc with just {}. (Do this intelligently, not blind search-and-replace -- make sure the file continues to be syntactically-valid JavaScript.) This will cause the script to not see metadata for any network interfaces, which might cause problems in some applications, but WSL isn't providing that metadata right now anyway.
  • Save the file. Exit your text editor.
  • Run cd .. as necessary to get yourself back to ~/.npm/<packagename>/<version>/. Run the following command to re-create the .tgz file: tar czvf package.tgz package
  • Go back to your project. Re-run npm install. You might need to remove your whole node_modules directory and reinstall.

Anyway, I think that gets all the steps? This is definitely not a polished solution; it would be great if someone with a little more node experience than I could give it a try and report back on what other hackery they needed to do.

@george-cz
Copy link

@aseering unfortunately, this isn't a workaround, nor fix, since it breaks the application. Its like saying "when your car doesn't steer correctly, remove the steering wheel"

@neoadventist
Copy link

neoadventist commented Aug 3, 2016

If only I can get this working then I can watch the files for when my test changes then I can be golden!

@calderhayes
Copy link

+1

@aseering
Copy link
Contributor

Hi @micahblu -- thanks for posting, but it's a long thread in part because people keep asking questions that have already been answered :-) So I hope you'll understand if I give you a brief answer and direct you to go read the thread.

In short: This problem has been fixed for a while now. The fix is only available in Insider builds, which are much newer than build 14393.

The fix is not being backported; it will ship with the next major version of Windows, which is due out in a few months. There's lots of discussion about all of this above.

@micahblu
Copy link

Thanks!

@mikaturk
Copy link

@aseering Will this be fixed in the creators update?
https://blogs.windows.com/windowsexperience/2017/03/29/windows-10-creators-update-coming-april-11-surface-expands-markets/#y78c8ro81mrI2dXQ.97
because if so, the fix is less than 2 weeks out :D

@mateusmedeiros
Copy link

@mikaturk It will. It has been fixed for us using insider buils for some good time now.

@sunilmut
Copy link
Member

@mikaturk

Will this be fixed in the creators update?

Yes, it will be.

@serbanghita
Copy link

serbanghita commented Apr 1, 2017

I'm waiting for the fix. Meanwhile I switched temporary to git bash for Windows in order to run my node builds. I still have high hopes for Windows Subsystem for Linux feature.

@feryardiant
Copy link

As per @nmai & @saschagehlich said, I've tried this command

> netsh interface teredo set state disabled

On cmd (as Administrator), but still got no luck with either ip addr show and ifconfig

$ feryardiant at MIMIN-ZENBOOK in ~
[11:13:10] → ip addr show
SO_SNDBUF: Invalid argument

$ feryardiant at MIMIN-ZENBOOK in ~
[11:13:13] → ifconfig
Warning: cannot open /proc/net/dev (Tidak ada berkas atau direktori seperti itu). Limited output.

And still having same issue on node js

EINVAL: invalid argument, uv_interface_addresses

Did I need to completely reinstall WSL again? or reboot my PC? or what? 😅

it crowd - restart please


Windows 10 Home 1607 build 14393.969

@benhillis
Copy link
Member

You are still on Anniversary Update, could you install Creators Update and try again?

@feryardiant
Copy link

Is the Creators Update already released publicly? or I need to join Windows Insider first?

Thanks for your fast reply @benhillis

@feryardiant
Copy link

No updates yet, unfortunately

image

@benhillis
Copy link
Member

Yes you can download now: https://www.microsoft.com/en-us/software-download/windows10ISO

@feryardiant
Copy link

Okay @benhillis, I'll try it and will back to you.

image

@feryardiant
Copy link

I can confirm that Creators Update is solve the issue. ifconfig and ip addr show works just fine,

$ feryardiant at Mimin-Zenbook in ~
[12:38:04] → ifconfig
eth1      Link encap:Ethernet  HWaddr 0a:00:27:00:00:02
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::3411:3e51:18ca:2394/64 Scope:Unknown
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth2      Link encap:Ethernet  HWaddr 0a:00:27:00:00:07
          inet addr:192.168.99.1  Bcast:192.168.99.255  Mask:255.255.255.0
          inet6 addr: fe80::ac6f:9be5:bf8:2298/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Global
          UP LOOPBACK RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wifi0     Link encap:UNSPEC  HWaddr 10-02-B5-52-3F-CD-00-00-00-00-00-00-00-00-00-00
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::f56d:7300:e95d:d95/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


$ feryardiant at Mimin-Zenbook in ~
[12:38:08] → ip addr show
8: eth0: <> mtu 1500 group default qlen 1
    link/ether 00:ff:ce:91:fd:d4
    inet 169.254.236.98/16 brd 169.254.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::347d:e364:27e4:ec62/64 scope global dynamic
       valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 group default qlen 1
    link/ether 0a:00:27:00:00:02
    inet 192.168.56.1/24 brd 192.168.56.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::3411:3e51:18ca:2394/64 scope link dynamic
       valid_lft forever preferred_lft forever
7: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 group default qlen 1
    link/ether 0a:00:27:00:00:07
    inet 192.168.99.1/24 brd 192.168.99.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::ac6f:9be5:bf8:2298/64 scope global dynamic
       valid_lft forever preferred_lft forever
1: lo: <LOOPBACK,UP> mtu 1500 group default qlen 1
    link/loopback 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope global dynamic
       valid_lft forever preferred_lft forever
6: wifi0: <BROADCAST,MULTICAST,UP> mtu 1500 group default qlen 1
    link/ieee802.11 10:02:b5:52:3f:cd
    inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic
       valid_lft 86345sec preferred_lft 86345sec
    inet6 fe80::f56d:7300:e95d:d95/64 scope global dynamic
       valid_lft forever preferred_lft forever
4: wifi1: <> mtu 1500 group default qlen 1
    link/ieee802.11 10:02:b5:52:3f:ce
    inet 169.254.113.41/16 brd 169.254.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::81f2:d837:a9ec:7129/64 scope global dynamic
       valid_lft forever preferred_lft forever

also my npm run build is working now.

$ feryardiant at Mimin-Zenbook in personal/codes/laravel-project on git:testing ●
[12:41:56] → npm run build

> @ build /mnt/d/Workspaces/personal/codes/laravel-project
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 95% emitting

 DONE  Compiled successfully in 14380ms                                                                      12:42:39
                                                                                                                       Asset       Size  Chunks                    Chunk Names
  assets/js/admin.js     301 kB       0  [emitted]  [big]  assets/js/admin
    assets/js/web.js     301 kB       1  [emitted]  [big]  assets/js/web
assets/css/admin.css   23 bytes    0, 0  [emitted]         assets/js/admin, assets/js/admin
  assets/css/web.css  519 bytes       0  [emitted]         assets/js/admin
   mix-manifest.json  194 bytes          [emitted]

Considering to remove babun from my PC 🤔

Thanks @benhillis

@SFLAQiu
Copy link

SFLAQiu commented Sep 5, 2017

ubuntu apt-get install npm
run npm err
how to solve?
so bad


root@2NH7VYN4YAJPLYK:~# npm

/usr/share/npm/node_modules/npmconf/config-defs.js:322
Object.keys(os.networkInterfaces()).map(function (nic) {
^
Error: EINVAL, invalid argument
at getLocalAddresses (/usr/share/npm/node_modules/npmconf/config-defs.js:322:18)
at Object. (/usr/share/npm/node_modules/npmconf/config-defs.js:269:23)
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/share/npm/node_modules/npmconf/npmconf.js:4:18)
at Module._compile (module.js:456:26)
root@2NH7VYN4YAJPLYK:# /usr/bin/node --version
bash: /usr/bin/node: No such file or directory
root@2NH7VYN4YAJPLYK:
#

@mikaturk
Copy link

mikaturk commented Sep 5, 2017

@SFLAQiu
You need to apt-get install node first

@aseering
Copy link
Contributor

aseering commented Sep 5, 2017

@SFLAQiu -- what version of Windows do you have? (Run ver at a Windows Command Prompt, and copy/paste its output here.) Is it version 14393?

That particular error should have been fixed in Windows build 15007. You can get a newer version through Windows Update.

@SFLAQiu
Copy link

SFLAQiu commented Sep 6, 2017

@aseering my windows os version is 14393,I'll try it out

@SFLAQiu
Copy link

SFLAQiu commented Sep 6, 2017

@mikaturk I've installed node

@SFLAQiu
Copy link

SFLAQiu commented Sep 6, 2017

have new question
I remove apt-get node and npm
then install nvm
nvm install success and nvm install stable already


root@2NH7VYN4YAJPLYK:/# nvm use 8
Now using node v8.4.0 (npm v5.3.0)
root@2NH7VYN4YAJPLYK:/# node -v
v8.4.0
root@2NH7VYN4YAJPLYK:/# npm -v
5.3.0
root@2NH7VYN4YAJPLYK:/# nvm list
-> v8.4.0
node -> stable (-> v8.4.0) (default)
stable -> 8.4 (-> v8.4.0) (default)
iojs -> N/A (default)
root@2NH7VYN4YAJPLYK:/#


but i restart bash,cmd node


root@2NH7VYN4YAJPLYK:/# node
The program 'node' can be found in the following packages:

  • node
  • nodejs-legacy
    Try: apt-get install
    root@2NH7VYN4YAJPLYK:/# node -v
    The program 'node' can be found in the following packages:
  • node
  • nodejs-legacy
    Try: apt-get install
    root@2NH7VYN4YAJPLYK:/#

need again to nvm use
why?

@phsantiago
Copy link

@MukhtarAsorori
Copy link

Is there any body can tell me how can fix this problem.
`D:\LSTU\LearnMySelf\web\Angular2\Angular2_GettingStarted\APM>npm start

[email protected] start D:\LSTU\LearnMySelf\web\Angular2\Angular2_GettingStarted\APM
tsc && concurrently "tsc -w" "lite-server"

node_modules/@angular/common/src/directives/ng_class.d.ts(48,34): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/aot/compiler.d.ts(44,32): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(342,20): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(344,28): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(346,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(348,23): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(350,17): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(352,25): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(433,63): error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(28,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,123): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,165): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(22,37): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(11,30): error TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(22,30): error TS2304: Cannot find name 'Set'.
node_modules/rxjs/Observable.d.ts(58,60): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
node_modules/rxjs/Observable.d.ts(74,59): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: tsc && concurrently "tsc -w" "lite-server"
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mukhtar\AppData\Roaming\npm-cache_logs\2018-06-03T08_09_19_261Z-debug.log

D:\LSTU\LearnMySelf\web\Angular2\Angular2_GettingStarted\APM>`

@dreyks
Copy link

dreyks commented Jun 3, 2018

update to the latest Node version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests