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

[bug] npm run using default node user instead of root #1669

Closed
robertsLando opened this issue Mar 16, 2022 · 1 comment
Closed

[bug] npm run using default node user instead of root #1669

robertsLando opened this issue Mar 16, 2022 · 1 comment

Comments

@robertsLando
Copy link

robertsLando commented Mar 16, 2022

Environment

  • Platform: Linux 7f44813ba8d7 5.13.0-35-generic 40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 GNU/Linux
  • Docker Version: 20.10.13
  • Node.js Version: 16.13.2
  • Image Tag: node:16.13.2-buster

Expected Behavior

When container is run with user: 0:0 (root) the function process.getuid() should return 0

Current Behavior

If we have a script like "test": "node -p \"process.getuid()\"" defined in package.json when we run it with npm run test it should output 0 but it prints 1000 instead (node user). If we lunch the same command without using npm run the output is correct:

root@7f44813ba8d7:/app# node -p "process.getuid()"
0
root@7f44813ba8d7:/app# npm run test

> @app/[email protected] test
> node -p "process.getuid()"

1000
root@7f44813ba8d7:/app# node -v
v16.13.2

Possible Solution

I tried to use

npm config set user 0
npm config set unsafe-perm true

and other workaround without any success

Steps to Reproduce

Described above

@robertsLando
Copy link
Author

Moved to npm: npm/cli#4589

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

No branches or pull requests

1 participant