Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created April 7, 2016 01:22
Show Gist options
  • Select an option

  • Save mattpodwysocki/4e6951fc93adae064a73ed0b2251d180 to your computer and use it in GitHub Desktop.

Select an option

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

rangedsp commented Apr 7, 2016

Copy link
Copy Markdown

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

@therocco

therocco commented Apr 7, 2016

Copy link
Copy Markdown

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

@mickeyinfoshan

Copy link
Copy Markdown

Same issue. @rangedsp any ideas?

@dmisdm

dmisdm commented Apr 23, 2016

Copy link
Copy Markdown

Getting this as well on Bash for windows!

@bkgoksel

bkgoksel commented May 8, 2016

Copy link
Copy Markdown

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

@woodgates

Copy link
Copy Markdown

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

@KaweIJ

KaweIJ commented Nov 6, 2020

Copy link
Copy Markdown

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
Copy Markdown

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

@DonKoko

DonKoko commented Jul 8, 2021

Copy link
Copy Markdown

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