-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
doc: add section about using npx with permission model #56539
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
@RafaelGSS and I tested this locally w/ both |
maybe add link to |
If you link please link to the latest version, not npm 8 |
Realized that this won't work for packages installed globally and for packages installed in the npx cache. The example given is for if the package is installed in the current package at cwd. Not sure if there's a good way to document what Examples using fish shell # installed globally
$ npm ls -g
/Users/wraithgar/.nvm/versions/node/v22.13.0/lib
├── [email protected]
$ npx --node-options="--permission --allow-fs-read=$(npm prefix -g)" json --version
json 11.0.0
written by Trent Mick
https://github.com/trentm/json # using npx cache
$ npx --node-options="--permission --allow-fs-read=$(npm config get cache)" semver parse 1.0.0
1.0.0 This seems like a lot to try to document for this flag. |
Maybe we can wrap the permission model as an npx flag? As a new npx feature |
I would discourage adding a new npm config for this, as it would mean it wouldn't work for existing versions of npx, and in a way that it was silently ignored so you wouldn't know it wasn't working. Also it would mean having to keep npm in sync w/ these params if they ever changed or were added to. It would be completely decoupled from Node.js config itself, meaning someone would just have to "remember" to do it if Node.js changed. Showing users how to set the flags in npx is the best option, as it allows them to update the flags w/o having to wait on npm to update, and already works. |
cc: @wraithgar