You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
Using sudo to execute npx (which in turn executes the command we really care about) results in an EPERM error with node v14.4.0 (npm v7.5.5). The same invocation works as expected with v12.20.2 (npm v6.14.11) or when invoked without npx.
When
Running an npm script that uses npx to execute a command
Where
macOS Catalina 10.15.7 (19H524)
node v14.4.0 (npm v7.5.5)
How
Current Behavior
process.getuid() returns an unprivileged user ID (e.g., 501), not the root user ID (i.e., 0)
. nvm use default
Now using node v14.4.0 (npm v7.5.5)
. npm run with-npx
> sudo-npx@1.0.0 with-npx
> sudo npx -c 'node -e "console.log(process.getuid())"'
501
Compare the result to:
. nvm use default
Now using node v14.4.0 (npm v7.5.5)
. run without-npx
> styra-ui@0.0.0 /Users/mikol/src/com/styra/ui
> sudo sh -c 'node -e "console.log(process.getuid())"'
0
Or compare the result to:
. nvm use lts/erbium
Now using node v12.20.2 (npm v6.14.11)
. run with-npx
> styra-ui@0.0.0 /Users/mikol/src/com/styra/ui
> sudo npx -c 'node -e "console.log(process.getuid())"'
0
Expected Behavior
process.getuid() should return 0 when a script is invoked with sudo npx -c
Who
n/a
References
n/a
The text was updated successfully, but these errors were encountered:
mikol
changed the title
[BUG] npx drops sudo euid/egid before executing command
[BUG] npx drops sudo uid/gid before executing command
Feb 23, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What / Why
Using sudo to execute npx (which in turn executes the command we really care about) results in an
EPERM
error with node v14.4.0 (npm v7.5.5). The same invocation works as expected with v12.20.2 (npm v6.14.11) or when invoked without npx.When
Where
How
Current Behavior
process.getuid()
returns an unprivileged user ID (e.g., 501), not the root user ID (i.e., 0)Steps to Reproduce
package.json
as follows:Expected Behavior
process.getuid()
should return0
when a script is invoked withsudo npx -c
Who
References
The text was updated successfully, but these errors were encountered: