Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created April 7, 2016 01:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/4e6951fc93adae064a73ed0b2251d180 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/4e6951fc93adae064a73ed0b2251d180 to your computer and use it in GitHub Desktop.
Installing global packages causes an error using NPM
# Installing Node/NPM
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
# Installing a package globally
root@localhost:/# npm install -g gulp
Error: could not get uid/gid
net.js:135
this._handle.open(options.fd);
^
Error: EINVAL: invalid argument, uv_pipe_open
at Error (native)
at new Socket (net.js:135:18)
at createWritableStdioStream (internal/process/stdio.js:142:16)
at process.stdout (internal/process/stdio.js:10:14)
at console.js:99:37
at NativeModule.compile (node.js:395:5)
at Function.NativeModule.require (node.js:340:18)
at node.js:223:27
at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/uid-number/get-uid-gid.js:16:1)
at Module._compile (module.js:413:34)
at /usr/lib/node_modules/npm/node_modules/uid-number/uid-number.js:37:16
at ChildProcess.exithandler (child_process.js:209:5)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:475:12)
@rangedsp
Copy link

rangedsp commented Apr 7, 2016

I'm getting the same issue on Bash on Ubuntu on Windows, have you got a fix yet?

@therocco
Copy link

therocco commented Apr 7, 2016

npm config set unsafe-perm true bypasses the above error.

@mickeyinfoshan
Copy link

Same issue. @rangedsp any ideas?

@dmisdm
Copy link

dmisdm commented Apr 23, 2016

Getting this as well on Bash for windows!

@bkgoksel
Copy link

bkgoksel commented May 8, 2016

I'm getting this as well, but nerdofsteel's solution seems to work so far!

@woodgates
Copy link

I got the error too, but after closing Visual Studio Code the error doesn't appear.

@KaweIJ
Copy link

KaweIJ commented Nov 6, 2020

I got the error too, but after closing Visual Studio Code the error doesn't appear.

Half an hour bashing my head on the table and my answer was as simple as turning VS off and on again.

@laveshgarg80
Copy link

I got the error too while installing react-router-dom but after restarting vs-code react-router-dom installed succesfully

@DonKoko
Copy link

DonKoko commented Jul 8, 2021

This is the only thing that worked for me. I had to basically stop everything that is using the node-modules folder.

  • turned off VSC
  • stopped local server

After that the install worked.

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