Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Using the npm_config_prefix results in a no such file or directory error when attempting to run a command via npx globally on [email protected]. The same command used to work on [email protected].
Expected Behavior
Global npx command works in conjunction with npm_config_prefix outside of a project/workspace.
Steps To Reproduce
$ mkdir repro
$ cd repro
$ npm i -g [email protected]
$ npm_config_prefix=/tmp/.foo npx serve@latest --help
# observe `serve` CLI is executed successfully and the help message is printed
Now, upgrade npm and repeat:
$ npm i -g [email protected]
$ npm_config_prefix=/tmp/.foo npx serve@latest --help
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path /private/tmp/.foo/lib
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat '/private/tmp/.foo/lib'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /…/.npm/_logs/2022-08-05T21_22_57_389Z-debug-0.log
💥 Observe npx errors and complains This is related to npm not being able to find a file..
Environment
- npm:
- Node.js: v16.14.0
- OS Name: macOS, Ubuntu 22
- System Model Name: M1 Macbook Pro, GitHub Action Runner
- npm config:
$ npm config ls
; node bin location = /Users/…/.nvm/versions/node/v16.14.0/bin/node
; node version = v16.14.0
; npm local prefix = /Users/…/Desktop/repro
; npm version = 8.16.0
; cwd = /Users/…/Desktop/repro
; HOME = /Users/…
; Run `npm config ls -l` to show all defaults.
Additionally, npm_config_prefix is set when running npx command.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Using the
npm_config_prefixresults in ano such file or directoryerror when attempting to run a command vianpxglobally on[email protected]. The same command used to work on[email protected].Expected Behavior
Global npx command works in conjunction with
npm_config_prefixoutside of a project/workspace.Steps To Reproduce
Now, upgrade
npmand repeat:💥 Observe
npxerrors and complainsThis is related to npm not being able to find a file..Environment
Additionally,
npm_config_prefixis set when runningnpxcommand.