-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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.userInfo throws if no username in docker container #25714
Comments
I think the behavior is correct. A documentation PR would be welcome though. |
I guess it throws right here - https://github.com/nodejs/node/blob/master/lib/os.js#L253 ? It does not seem like it ever gets to the next line to throw the generic error with empty context. Edit: Or it actually mutates the |
`os.userInfo` throws an exception which was not documented in environments like: `docker run --user $(id -u): $(id -g)` PR-URL: nodejs#25724 Fixes: nodejs#25714
`os.userInfo()` throws an exception which was not documented in environments like: `docker run --user $(id -u): $(id -g)`. PR-URL: #25724 Fixes: #25714 Reviewed-By: James M Snell <[email protected]>
Hi @raido even-though I am running node:12.0.0 on docker I still get the same error? Is there anything else I need to do to resolve this issue ? |
Maybe you could use this package: https://github.com/sindresorhus/username? It has fallback logic for missing username case: sindresorhus/username#22 |
many thanks @raido what do you mean exactly by that. instead of which package I should used that? I am trying to do ember build that's where I get this error. |
Does you app happen to use |
no I don't have that specific package, The only package I found in my project that references uv_os_get_passwd , is in node-gyp . It seems in the latest version of it ( v 5.1.1) this issue is somehow addressed nodejs/node-gyp@c4002de, but updating it to that version still not resolving the issue :( . Is there an workaround that I can use within jenkins to fix this issue? I am using jenkins Pipeline and I have simply :
|
it turned out all I needed to do was adding docker volumne mapping from /etc/passwd to /etc/passwd. like this :
|
Original issue opened here: sindresorhus/username#21
It turns out that running a script with
docker run
with--user
flag set, then user actually has no$HOME
orusername
. This in turn causes following error:uv_os_get_passwd returned ENOENT (no such file or directory)
ifos.userInfo()
is accessed.Some people have resorted to try catch blocks:
https://github.com/moleculerjs/moleculer/pull/396/files#diff-38423b3db1f1c2a43666c7ad898ba126R45
But is is not documented that
os.userInfo()
ever throws - https://nodejs.org/dist/latest-v10.x/docs/api/os.html#os_os_userinfo_optionsThe text was updated successfully, but these errors were encountered: