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

Issue with non 'username' defined #2373

Closed
beltran-rubo opened this issue Apr 12, 2021 · 3 comments · Fixed by #2375
Closed

Issue with non 'username' defined #2373

beltran-rubo opened this issue Apr 12, 2021 · 3 comments · Fixed by #2375

Comments

@beltran-rubo
Copy link

Related to this, still an issue when the username is not defined, only the user ID e.g. that is common in 'non-root' containers for OpenShift https://docs.openshift.com/container-platform/3.3/creating_images/guidelines.html#openshift-container-platform-specific-guidelines.

I have no name!@52545ce360b8$ node-gyp --help
os.js:272
    throw new ERR_SYSTEM_ERROR(ctx);
    ^

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (os.js:272:11)
    at Object.<anonymous> (/opt/bitnami/node/lib/node_modules/node-gyp/lib/find-python.js:11:76)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/bitnami/node/lib/node_modules/node-gyp/lib/configure.js:11:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -2,
    code: 'ENOENT',
    message: 'no such file or directory',
    syscall: 'uv_os_get_passwd'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

Python is in the path so a good option could be to add a fallback or not return an error for the line

const username = process.env.USERNAME || process.env.USER || require('os').userInfo().username

Originally posted by @beltran-rubo in #2333 (comment)

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Apr 12, 2021

@beltran-rubo I have a fix for this on a local branch. Having gotten this a little bit wrong the first time (as proved by your bug report), I am trying very hard to arrive at a design that is rock solid and with good code patterns.

That said, the simplest fix would be for node-gyp to not attempt os.userInfo() or to only attempt it in a try {} block.

Once I am happy with the design (I think that can be today) I will post it as a PR. But if posting it right away as a Work-In-Progress PR would be helpful, I can do that as well.

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Apr 12, 2021

@beltran-rubo here is the Pull Request with my proposed fix: #2375

@beltran-rubo
Copy link
Author

Awesome thanks!

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

Successfully merging a pull request may close this issue.

2 participants