node-gyp
node-gyp copied to clipboard
removing breaking space
space between -- and npm_config_global cause the following error:
'npm_config_global' is not recognized as an internal or external command,
Checklist
- [ ]
npm install && npm test
passes - [ ] tests are included
- [ ] documentation is changed or added
- [ ] commit message follows commit guidelines
Description of change
@owl-from-hogvarts @DeeDeeG Your reviews, please.
Hi, thanks for the ping. I have to say the commands modified in this PR should work without modification on Unix-like OSes. Linux and macOS, mainly.
For what it's worth, this looks like Windows cmd.exe ~~or Powershell~~ to me:
XYZ is not recognized as an internal or external command
Windows' cmd and powershell do not understand the "ENV_VAR=value command arguments
" syntax.
The commands in this section of the document are only meant to work on Unix-like OSes (Linux or macOS mainly). There is a separate section of the instructions for Windows elsewhere in the document, which should work okay on Windows. I suggest trying those as written currently.
Furthermore, I agree with all of what @owl-from-hogvarts said above.
To add to that...
In plain English, the command updated by this PR is meant to
- Go into the global install dir (
npm explore
with-g
flag) - From there go into the subdirectory
npm/node_modules/@npmcli/run-script
(npm 7 or 8) ornpm/node_modules/npm-lifecycle
(npm 6 or older) - Set the environment variable
npm_config_global=false
(npm 7 or 8) - Finally, run the command after the
--
, namely:npm install node-gyp@latest
So in summary, we are temporarily moving into the internal dependencies of the globally installed npm
and updating its copy of node-gyp
.
The "command -- positional arguments here
" syntax convention is sometimes used in Unix-style command-line tools to have a main command x
and a --
and then some potentially complex or ambiguous argument y
after. The --
allows to clarify that whatever follows is a "positional argument", where being after the --
tells you the meaning.
As @owl-from-hogvarts mentioned above, npm explore
reserves a special meaning for anything after the --
. Specifically: For npm explore
, anything after the --
is a command to run after moving to the specified directory.
Changing it to --something
makes what follows a flag rather than a positional argument. So it would instead tack a flag on to npm explore
. This would probably not be a flag npm explore
is programmed to recognize or respond to, so the flag would likely be ignored... And the npm install node-gyp@latest
would not be interpreted as a separate command to run.
So this PR would remove the crucial step of actually installing newer node-gyp
.
Again I suggest trying the steps in the Windows section of the document and seeing if those work, if you are indeed on Windows.
If this continues to be an issue, please try following the guidance above and if that does not work, open a new issue.