npm config edit user or group - not working
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
when executing npm package executable on a policy restricted PC the user/group config does not take into effect,
i am on an enterprise windows PC, after installing npm-gui (also happens on nx.dev StoryBoard),
when i run a command that tries to launch a server (listen to a port), it execute it with the DefaultAccount, the output say: [as default]
the PC has a policy that one user cannot execute applications as another user,
so i tried setting the user (UID) or group (GID) so npm will use that user to execute the commands, but it does not effect the process
actual received output:
C:\Test>npm-gui
listening on: localhost 13377
node:internal/errors:456
ErrorCaptureStackTrace(err);
^
Error: spawn EPERM
at ChildProcess.spawn (node:internal/child_process:415:11)
at Object.spawn (node:child_process:609:9)
at Object.open [as default] (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\npm-gui\node_modules\open\index.js:204:34) {
errno: -4048,
code: 'EPERM',
syscall: 'spawn'
}
Expected Behavior
setup UID to use when executing npm package executables
as stated at: https://docs.npmjs.com/cli/v6/using-npm/config#user
set:
npm config set user MYUsername
call:
npm-gui
expect server to launch properly and to see npm-gui UI
as shown here: https://www.npmjs.com/package/npm-gui
Steps To Reproduce
- on a PC with policy that disallow running as another user (or where DefaultAccount is disabled)
- install node 16.3.0
- run:
npm i -g npm-gui - run:
npm config set user=MyUsername - run:
npm-gui
in step 3 i also tried: npm config set group=MY_GID as stated here: https://docs.npmjs.com/cli/v6/using-npm/config#group
Environment
- OS: Windows 10
- Node: 16.3.0
- npm: 7.18.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows 10 behavior with Node 16.3.0, npm 7.18.1, npm-gui, and the documented user and group configuration commands. Read the npm config documentation for user and group, then trace how those settings affect package executable launches; done means the configured identity is honored and npm-gui starts without the spawn EPERM error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100