Open rotu opened 1 year ago
I think this is related to a deeper issue with @npmcli/run-script
. spawnWithShell
seems VERY suspect:
^
-escaped spaces."'my double quoted path'"
will open quotes at the first "
character and then say the quotes have ended at the '
character.which.sync
with the quotes intact. So it's looking for an executable with those quotes in its path.isCmd
regex searches for \
but /
is a legal alternative path separator on windows.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
On Windows, if the
EDITOR
environment variable is set,npm config edit
does not resolve it as either a literal path nor a shell command.Expected Behavior
I expect either:
Steps To Reproduce
EDITOR
npm config edit
If the value of
EDITOR
has a space in it, it is truncated there (even if the executable is surrounded by"
, meaning you can't use a path with a space in it. None of the following work:The error message indicates that the path is truncated at the first space, e.g.
normal shell resolution of a command does not work:
The following does work:
Environment
prefix = "C:\Users\dan\AppData\Roaming\npm"
; "user" config from C:\Users\dan.npmrc
@cs:registry = "http://reg.example.com" //registry.npmjs.org/:_authToken = (protected)
; node bin location = C:\Program Files\nodejs\node.exe ; node version = v18.17.1 ; npm local prefix = C:\Users\dan\Source\Cerulean\SonarView ; npm version = 9.8.1 ; cwd = C:\Users\dan\Source\Cerulean\SonarView ; HOME = C:\Users\dan ; Run
npm config ls -l
to show all defaults.