[BUG] npm exec requires elevation for some packages
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
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
Executing any npm package in an unelevated shell will output this (the text is even like this in PowerShell):
'"node"' is not recognized as an internal or external command,
operable program or batch file.
It works as expected when the shell is elevated.
Expected Behavior
ESLint was meant to be executed and see what issues were in the JavaScript file.
Steps To Reproduce
- Create a
script.jsfile in a directory. Make sure you have ESLint installed. - Open the directory with the
script.jsfile in a normal shell (i.e. without elevation). - Run
npm exec eslint script.js.
Environment
- npm: 8.19.2
- Node.js: v18.9.0
- OS Name: Windows 11 Version 22H2 Build 22621.521
- System Model Name: Acer Nitro 5
- npm config:
; "builtin" config from C:\Users\Keyacom\AppData\Roaming\npm\node_modules\npm\npmrc
prefix = "C:\\Users\\Keyacom\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.9.0
; npm local prefix = C:\Users\Keyacom\documents\github\pages-from-school\psi\grade2\reklama-anim
; npm version = 8.19.2
; cwd = C:\Users\Keyacom\documents\github\pages-from-school\psi\grade2\reklama-anim
; HOME = C:\Users\Keyacom
NOTE: Originally filed as eslint/eslint#16338. I've tested this with Prettier, and the same issue happened.
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
Reproduce the problem on Windows 11 by running npm exec eslint script.js from an unelevated shell, then compare it with the elevated-shell behavior. Trace the npm exec path involved in launching ESLint and verify that the command runs successfully without elevation, including the reported PowerShell error case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100