镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Issue with non 'username' defined #2373

Closed

Description

@beltran-rubo

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)

Activity

  1. DeeDeeG commented on Apr 12, 2021

    @DeeDeeG
    Contributor

    @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.

  2. DeeDeeG commented on Apr 12, 2021

    @DeeDeeG
    Contributor

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

  3. beltran-rubo commented on Apr 13, 2021

    @beltran-rubo
    Author

    Awesome thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions