Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

uid must be an unsigned int #13918

Closed
copriminister opened this issue Sep 9, 2016 · 61 comments
Closed

uid must be an unsigned int #13918

copriminister opened this issue Sep 9, 2016 · 61 comments

Comments

@copriminister
Copy link

sudo npm install -g ios-sim
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int

the whole npm-debug.log is attached

@addaleax
Copy link
Contributor

the whole npm-debug.log is attached

can you upload that file somewhere?

@copriminister
Copy link
Author

yes, here you can download the npm-debug.log
http://www2.copri.eu/tinkapp/npm-debug.log

best regards, Rainer

Am 10.09.16 um 16:50 schrieb Anna Henningsen:

the whole npm-debug.log is attached

can you upload that file somewhere?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#13918 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AVFKbZgEU27zpqUz6_coYXJCGEy96gfwks5qosPDgaJpZM4J5UAl.

@addaleax
Copy link
Contributor

Weird. Does that occur when installing any of these modules manually?

abbrev@1.0.9
base64-js@0.0.8
lodash@3.10.1
shelljs@0.2.6
tail@0.4.0
util-deprecate@1.0.2
xmlbuilder@4.0.0
xmldom@0.1.22
bplist-parser@0.0.6
nopt@1.0.9
plist@1.2.0
simctl@0.0.9
ios-sim@5.0.8

Can you edit npm’s files yourself, e.g. by applying this patch in /usr/local/lib/node_modules/npm, and see if the output is helpful?

diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js
index 2798050604be..c517ce4eebfc 100644
--- a/node_modules/graceful-fs/polyfills.js
+++ b/node_modules/graceful-fs/polyfills.js
@@ -229,6 +229,8 @@ function chownFix (orig) {
   if (!orig) return orig
   return function (target, uid, gid, cb) {
     return orig.call(fs, target, uid, gid, function (er) {
+      if (er && er.message.match(/uid must be an unsigned int/))
+        console.trace(target, uid, gid);
       if (chownErOk(er)) er = null
       if (cb) cb.apply(this, arguments)
     })

(If you want, I’d be open to a remote debugging session over IRC, I’m addaleax on freenode)

@silurt
Copy link

silurt commented Sep 10, 2016

i just got the same issue when installing electron
here is my error
`npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-g" "electron"
npm ERR! node v6.3.1
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-g" "electron"
npm ERR! node v6.3.1
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Library/npm-debug.log`

@addaleax
Copy link
Contributor

Hm, @puresamari, same questions for you? Any chance you’d want to hop onto IRC and try to work this out?

@StackOverflo
Copy link

I am also getting the same error when trying to install yeoman. I have the latest version of npm. Anyone find a solution yet?

@rbrinson
Copy link

Has anyone been able to resolve this problem? I am also getting the "uid must be an unsigned int" error when I try to install typescript or generator-hottowel. It could be that any package would give me this problem at the moment, but these are the two that I have been trying to install. I have been experiencing this problem for the past two days. My installation is on OSX 10.11.6 with node v6.4.0 and npm 3.10.8.

@mhaddon
Copy link

mhaddon commented Sep 12, 2016

I have this problem on OSX 10.10.5 with node v6.4.0 and npm 3.10.8

$ sudo npm install -g browserify
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.8

npm ERR! uid must be an unsigned int
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/redacted/npm-debug.log

The log file is attached
a.txt

[edit]
I installed node version 4.5 from here: https://nodejs.org/en/, and that works for now.

@copriminister
Copy link
Author

Hello and sorry for the response time.

Am 10.09.16 um 20:01 schrieb Anna Henningsen:

Weird. Does that occur when installing any of these modules manually?

What is the meaning of "installing manually" in this context?
sudo npm install -g ios-sim

I'm trying to install cordova ... it depends on ios-sim and ios-deploy ...

Thanks, I have done the patch.
You can get the new npm-debug on:
http://www2.copri.eu/tinkapp/npm-debug.log.2

best regards, Rainer

|abbrev@1.0.9 base64-js@0.0.8 lodash@3.10.1 shelljs@0.2.6 tail@0.4.0
util-deprecate@1.0.2 xmlbuilder@4.0.0 xmldom@0.1.22 bplist-parser@0.0.6
nopt@1.0.9 plist@1.2.0 simctl@0.0.9 ios-sim@5.0.8 |

Can you edit npm’s files yourself, e.g. by applying this patch in
|/usr/local/lib/node_modules/npm|, and see if the output is helpful?

diff --git a/node_modules/graceful-fs/polyfills.js
b/node_modules/graceful-fs/polyfills.js
index 2798050604be..c517ce4eebfc 100644
--- a/node_modules/graceful-fs/polyfills.js
+++ b/node_modules/graceful-fs/polyfills.js
@@ -229,6 +229,8 @@ function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function (er) {

  • if (er && er.message.match(/uid must be an unsigned int/))
  • console.trace(target, uid, gid);
    if (chownErOk(er)) er = null
    if (cb) cb.apply(this, arguments)
    })

(If you want, I’d be open to a remote debugging session over IRC, I’m
|addaleax| on freenode)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#13918 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AVFKbYl00U5AEC-I1ESUR6bhR06pDu9aks5qovBpgaJpZM4J5UAl.

@addaleax
Copy link
Contributor

Thanks, I have done the patch. You can get the new npm-debug on:

Sorry, the patch’s output should appear on the console, not in the debug log (I don’t how well it is possible to generate a stack trace in a module that’s a dependency of npm and send that through npm’s logger… it should work but I didn’t want to dare trying something like that from remote).

What is the meaning of "installing manually" in this context?

Something like sudo npm install -g lodash@3.10.1. (Does this only happen with install -g?)

@silurt
Copy link

silurt commented Sep 12, 2016

hi addaleax, for me its only happening when installing globally. 🎯

@addaleax
Copy link
Contributor

okay, it would probably still be kind of good if somebody were up for a debugging session, but just to make sure – does this happen for anybody with npm@3.10.7? If it’s a regression, I’m pretty sure the npm team would like to know about it.

@silurt
Copy link

silurt commented Sep 12, 2016

i have npm@3.10.8

@silurt
Copy link

silurt commented Sep 12, 2016

hey everyone, i just found a possible fix at least it worked for me.
I just fixed my npm permissions with this link to the npm docs. I used the first Option.

can you check if that also works for you?

@BallisticPain
Copy link

@puresamari
Thanks for that! I wasn't sure what I needed to do, but was assuming it was a permissions issue. First option also worked for me. Thanks!

@rbrinson
Copy link

@puresamari Thank you! The first option also worked for my situation.

@copriminister
Copy link
Author

Hello,

I had still done the checking permission option before.

Now I tried installing without -g:

wurm:~ ragu$ npm init --yes
Wrote to /Users/ragu/package.json:

{
"name": "ragu",
"version": "1.0.0",
"description": "",
"main": "polyfills.js",
"dependencies": {
"ios-sim": "^5.0.8"
},
"devDependencies": {},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}

wurm:~ ragu$ sudo npm install ios-sim
ragu@1.0.0 /Users/ragu
└── ios-sim@5.0.8

npm WARN ragu@1.0.0 No description
npm WARN ragu@1.0.0 No repository field.


It seems ok

With -g:

wurm:~ ragu$ sudo npm install -g ios-sim
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"ios-sim"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:

npm ERR! /Users/ragu/npm-debug.log

and at last my permissions:
wurm:~ ragu$ ls -al /usr/local/lib/
total 0
drwxr-xr-x 4 root wheel 136 2 Mai 2014 .
drwxr-xr-x 7 root wheel 238 9 Sep 18:25 ..
drwxr-xr-x 3 root wheel 102 9 Sep 20:03 dtrace
drwxr-xr-x 5 ragu wheel 170 13 Sep 09:40 node_modules
wurm:~ ragu$ ls -al /usr/local/lib/node_modules/
total 0
drwxr-xr-x 5 ragu wheel 170 13 Sep 09:40 .
drwxr-xr-x 4 root wheel 136 2 Mai 2014 ..
drwxr-xr-x 15 root wheel 510 13 Sep 09:40 .staging
drwxr-xr-x 20 ragu staff 680 9 Sep 18:42 cordova
drwxr-xr-x 27 ragu staff 918 9 Sep 20:05 npm
wurm:~ ragu$ ls -al /usr/local/lib/node_modules/npm/
total 728
drwxr-xr-x 27 ragu staff 918 9 Sep 20:05 .
drwxr-xr-x 5 ragu wheel 170 13 Sep 09:40 ..
drwxr-xr-x 3 ragu staff 102 2 Jul 02:48 .github
-rw-r--r-- 1 ragu staff 2738 9 Sep 03:20 .mailmap
-rw-r--r-- 1 ragu staff 519 3 Jun 19:59 .npmignore
-rw-r--r-- 1 ragu staff 1128 2 Jul 02:48 .travis.yml
-rw-r--r-- 1 ragu staff 16025 9 Sep 03:21 AUTHORS
-rw-r--r-- 1 ragu staff 243920 9 Sep 03:20 CHANGELOG.md
-rw-r--r-- 1 ragu staff 503 3 Jun 19:59 CONTRIBUTING.md
-rw-r--r-- 1 ragu staff 9742 1 Jul 22:52 LICENSE
-rw-r--r-- 1 ragu staff 4946 1 Jul 22:52 Makefile
-rw-r--r-- 1 ragu staff 4673 9 Sep 03:20 README.md
-rw-r--r-- 1 ragu staff 1144 1 Jul 00:48 appveyor.yml
drwxr-xr-x 7 ragu staff 238 9 Sep 20:05 bin
drwxr-xr-x 4 ragu staff 136 9 Sep 20:05 changelogs
-rwxr-xr-x 1 ragu staff 48 1 Jul 22:52 cli.js
-rwxr-xr-x 1 ragu staff 521 3 Jun 19:59 configure
drwxr-xr-x 5 ragu staff 170 9 Sep 20:05 doc
drwxr-xr-x 8 ragu staff 272 9 Sep 20:05 html
drwxr-xr-x 64 ragu staff 2176 9 Sep 20:05 lib
-rw-r--r-- 1 ragu staff 156 3 Jun 19:59 make.bat
drwxr-xr-x 5 ragu staff 170 9 Sep 20:05 man
drwxr-xr-x 85 ragu staff 2890 9 Sep 20:05 node_modules
-rw-r--r-- 1 ragu staff 0 9 Sep 20:05 npmrc
-rw-r--r-- 1 ragu staff 48204 9 Sep 20:05 package.json
drwxr-xr-x 13 ragu staff 442 9 Sep 20:05 scripts
drwxr-xr-x 6 ragu staff 204 9 Sep 20:05 test

Ok, if you want a remote hacking session on my macbook. I can configure
ssh remote access ...

best regards, Rainer

Am 12.09.16 um 21:19 schrieb Anna Henningsen:

Thanks, I have done the patch. You can get the new npm-debug on:

Sorry, the patch’s output should appear on the console, not in the debug
log (I don’t how well it is possible to generate a stack trace in a
module that’s a dependency of npm and send that through npm’s logger… it
should work but I didn’t want to dare trying something like that from
remote).

What is the meaning of "installing manually" in this context?

Something like |sudo npm install -g lodash@3.10.1|. (Does this only
happen with |install -g|?)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#13918 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AVFKbdCgFCtQwqUJ6ZgBz7m6jdEaYn_Mks5qpaXMgaJpZM4J5UAl.

+++ Rainer Gümpelein +++ www.GNU-Systems.de +++ www.COPRI.eu +++
0761-4587011 +++

@addaleax
Copy link
Contributor

Ok, if you want a remote hacking session on my macbook. I can configure ssh remote access ...

That might be cool, but it also might not be necessary, I can reproduce the failure in Travis CI and can probably go from there

@addaleax
Copy link
Contributor

So, turns out this is a bug in Node.js core where the UID for nobody on OS X, which is -2 converted to an unsigned integer, would be returned as a signed integer by fs.stat(). Proposed fix for that: nodejs/node#8515

This only occurs with npm@3.10.8; in that release, write-file-atomic was updated to a new version that contains the responsible calls to stat()/chown().

addaleax added a commit to addaleax/node that referenced this issue Sep 13, 2016

Verified

This commit was signed with the committer’s verified signature.
gjtorikian Garen Torikian
`FChown` and `Chown` test that the `uid` and `gid` parameters
they receive are unsigned integers, but `Stat()` and `FStat()`
would return the corresponding fields of `uv_stat_t` as signed
integers. Applications which pass those these values directly
to `Chown` may fail
(e.g. for `nobody` on OS X, who has an `uid` of `-2`, see e.g.
nodejs/node-v0.x-archive#5890).

This patch changes the `Integer::New()` call for `uid` and `gid`
to `Integer::NewFromUnsigned()`.

All other fields are kept as they are, for performance, but
strictly speaking the respective sizes of those
fields aren’t specified, either.

Ref: npm/npm#13918
@addaleax
Copy link
Contributor

@javaminister Thanks for all the debugging information! I’m not sure there’s anything better you can do right now other than what @puresamari suggested in #13918 (comment), so maybe you could add a link to that in your first comment here? That might be helpful for anyone else who comes by this thread.

@iarna
Copy link
Contributor

iarna commented Sep 13, 2016

@addaleax For future reference, for one-off instrumentation going to the debug log I'd do it like this:

diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js
index 2798050604be..c517ce4eebfc 100644
--- a/node_modules/graceful-fs/polyfills.js
+++ b/node_modules/graceful-fs/polyfills.js
@@ -229,6 +229,8 @@ function chownFix (orig) {
   if (!orig) return orig
   return function (target, uid, gid, cb) {
     return orig.call(fs, target, uid, gid, function (er) {
+      if (er && er.message.match(/uid must be an unsigned int/))
+        require('npmlog').warn('!!!', target, uid, gid, new Error().stack)
       if (chownErOk(er)) er = null
       if (cb) cb.apply(this, arguments)
     })

@addaleax
Copy link
Contributor

@iarna thanks, that makes sense! (and I should have had that idea… but it turns out the patch wouldn’t have worked anyway. 😄)

@iarna
Copy link
Contributor

iarna commented Sep 13, 2016

¯_(ツ)_/¯ =)

@copriminister
Copy link
Author

for right now my solution is to reinstall the node.js (4.5.0) for
macintosh and do not update npm. Keep installed npm-2.15.9 and
everything goes well. Quite simple.-/

@addaleax, thanks a lot for your work!
good time!

Am 13.09.16 um 14:17 schrieb Anna Henningsen:

@javaminister https://github.com/javaminister Thanks for all the
debugging information! I’m not sure there’s anything better you can do
right now other than what @puresamari https://github.com/puresamari
suggested in #13918 (comment)
#13918 (comment), so
maybe you could add a link to that in your first comment here? That
might be helpful for anyone else who comes by this thread.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#13918 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AVFKbcGcPbq99e2xpwB_van_UJEREqJ7ks5qppRigaJpZM4J5UAl.

@addaleax addaleax mentioned this issue Oct 6, 2016
1 task
@prashmi9
Copy link

prashmi9 commented Oct 6, 2016

I am still not able to run Gulp. It always give me error

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

I have updated minimatch file and now version it shows:
3.10.8
Please help. This is urgent!

@addaleax
Copy link
Contributor

addaleax commented Oct 6, 2016

@prashmi9 Those are warnings, and you can ignore them (or generally anything that starts with npm WARN if you’re not working on your own packages).

If there’s something that doesn’t work, it would probably be helpful if you can be a bit more specific about what exactly doesn’t work?

@copypasteho
Copy link

Can confirm this link worked beautifully : https://rockwithazure.wordpress.com/2016/09/24/sp-framework-macos-sierra-troubles-and-resolution/

I used the Github zip file method (found here: https://github.com/tj/n).

Following that Github tutorial, I ran the following commands (4 separate steps) :

sudo npm cache clean -f
sudo npm install -g n
sudo n latest
npm install npm@latest -g

no more UID errors (Mac OS Sierra).
node -v
6.7.0

npm -v
3.10.3

No idea how this worked but it did. phew

@iarna iarna closed this as completed in b3f9bf1 Oct 7, 2016
Fishrock123 pushed a commit to nodejs/node that referenced this issue Oct 11, 2016

Verified

This commit was signed with the committer’s verified signature.
gjtorikian Garen Torikian
`FChown` and `Chown` test that the `uid` and `gid` parameters
they receive are unsigned integers, but `Stat()` and `FStat()`
would return the corresponding fields of `uv_stat_t` as signed
integers. Applications which pass those these values directly
to `Chown` may fail
(e.g. for `nobody` on OS X, who has an `uid` of `-2`, see e.g.
nodejs/node-v0.x-archive#5890).

This patch changes the `Integer::New()` call for `uid` and `gid`
to `Integer::NewFromUnsigned()`.

All other fields are kept as they are, for performance, but
strictly speaking the respective sizes of those
fields aren’t specified, either.

Ref: npm/npm#13918
PR-URL: #8515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

undo accidental change to other fields of uv_fs_stat
@bjcangyue
Copy link

bogon:~ zql$ sudo npm install -g n
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "n"
npm ERR! node v4.2.4
npm ERR! npm v3.10.8

npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/zql/npm-debug.log

@luizlugo
Copy link

I was having this issue when trying to install a package that I generated with Yeoman-generator, after installed node version 6.7.0 my issue was fixed.

Thanks

@l2dy
Copy link

l2dy commented Oct 19, 2016

@bjcangyue Upgrade your node to 6.9.0 and it should work.

@Huanzhang89
Copy link

just wanted to clarify that the solution @puresamari provided works because it allows packages to be installed globally without using sudo and that the underlying issue is in using sudo alongside npm install.

@theskillwithin
Copy link

*downgrade to 6.9.0

@snow-swallow
Copy link

I fixed this by reinstalling node and npm.

@ksharifbd
Copy link

Upgrading to node v6.9.1 has fixed this for me :)

MylesBorins pushed a commit to nodejs/node that referenced this issue Oct 24, 2016

Verified

This commit was signed with the committer’s verified signature.
gjtorikian Garen Torikian
`FChown` and `Chown` test that the `uid` and `gid` parameters
they receive are unsigned integers, but `Stat()` and `FStat()`
would return the corresponding fields of `uv_stat_t` as signed
integers. Applications which pass those these values directly
to `Chown` may fail
(e.g. for `nobody` on OS X, who has an `uid` of `-2`, see e.g.
nodejs/node-v0.x-archive#5890).

This patch changes the `Integer::New()` call for `uid` and `gid`
to `Integer::NewFromUnsigned()`.

All other fields are kept as they are, for performance, but
strictly speaking the respective sizes of those
fields aren’t specified, either.

Ref: npm/npm#13918
PR-URL: #8515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

undo accidental change to other fields of uv_fs_stat
MylesBorins pushed a commit to nodejs/node that referenced this issue Oct 26, 2016
`FChown` and `Chown` test that the `uid` and `gid` parameters
they receive are unsigned integers, but `Stat()` and `FStat()`
would return the corresponding fields of `uv_stat_t` as signed
integers. Applications which pass those these values directly
to `Chown` may fail
(e.g. for `nobody` on OS X, who has an `uid` of `-2`, see e.g.
nodejs/node-v0.x-archive#5890).

This patch changes the `Integer::New()` call for `uid` and `gid`
to `Integer::NewFromUnsigned()`.

All other fields are kept as they are, for performance, but
strictly speaking the respective sizes of those
fields aren’t specified, either.

Ref: npm/npm#13918
PR-URL: #8515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

undo accidental change to other fields of uv_fs_stat
@yhippa
Copy link

yhippa commented Nov 11, 2016

I tried every other solution on here but upgrading to the latest version (6.9.1) also worked for me. On macOS 10.12.1.

@josemartos
Copy link

Exactly, just in case one more opinion: with the version 6.9.1 is working fine.

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

No branches or pull requests