This change request is to add support for NPX to nvm-windows.
This is an enhancement request inspired by Introducing npx: an npm package聽runner. When nodejs v8+ is installed traditionally (without nvm-windows) it includes npm v5+ and the new utility "npx".
$ nvm use 6.11.0
Now using node v8.1.4 (64-bit)
$ npx --version
npx is not supported with the current version of npm
$ nvm use 8.1.4
Now using node v8.1.4 (64-bit)
$ npx --version
5.0.3
This is an npm workflow concern, not a node versioning concern.
Node 8.1.4 ships with npm 5.0.3. No version of node ships with npm 5.2.0 _yet_ (the first version of npm to support npx). When node eventually starts shipping with npm 5.2.0, npx will be available. There is no need to do anything within nvm-windows to accomplish this. In the meantime, users can upgrade npm as the article suggests.
Sorry, I didn't realize npx was not included yet. However, I'd like to re-open this ticket as nvm-windows would still need modification to support npx. See line 270 of src/nvm.go has a comment and code for "Copy the npm and npm.cmd files to the installation directory".
As an aside, yes I realize I'm being lazy but not submitting a PR. I am being hopeful someone else will volunteer. :)
We'll see if this even remains (probably will, but maybe not in it's current form). The version management group is actively discussing the Windows installation process now, which will have an impact on this. It remains to be seen if this will end up being entirely the responsibility of npm or not, and the most likely answer is that it will.
Ironically, roughly six hours later (insert "The Lego Movie"-style image here): https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V8.md#8.2.0
鈼he
npm
CLI has been updated to version 5.3.0. In particular, it now comes with thenpx
binary, which is also shipped with Node.
I've confirmed I get npx
if I install Node on Windows through the official installer.
However, npx
is not available after performing nvm install 8.2.0
and then nvm use 8.2.0
.
(On the other hand, the version of npx
I got with the official installer happens to be completely broken on Windows, so installing the same version with nvm-windows
isn't going to help till they get that fixed, heh heh.)
I added support for this in the master branch, since it is now shipping with Node 8.2.0. As @ScottFreeCode pointed out, it's pretty broken... but the install is complete. The experience is the same as a native install (for better or worse)
I'm still waiting for feedback regarding issues that should be resolved in 1.1.6. Once those are all settled, I'll cut a new release file (still 1.1.6) with the new additions from https://github.com/coreybutler/nvm-windows/commit/ce756027a816042ed41c3ee60b18d0ebc2599c2b.
Hi, it seems that this is still a problem.
I have a fresh install of nvm after which I installed both [email protected] + [email protected]
and [email protected] + [email protected]
Doing npx --version
gives npx: command not found
for both.
What happens if I npm i -g npx
? Does this interfere with nvm management?
Using Win7 64x.
Having the same issue as above. My versions are [email protected] + [email protected]
and [email protected] + [email protected]
. Not sure whether it's worth mentioning that I installed node 10.6.0 first and 8.11.3 second.
Can confirm. I have had 8.x for some half a year, yesterday I've installed node 10.6 and got no npx:
```
C:Usersduricz>npx
'npx' is not recognized as an internal or external command,
operable program or batch file.
C:Usersduricz>nvm v
1.1.6
C:Usersduricz>node -v
v10.6.0
C:Usersduricz>npm -v
6.1.0
C:Usersduricz>```
Same experience here. No npx.cmd in Node v8.11.3 or v10.5.0 installed using NVM for Windows. npm i -g npx
solves the problem. Not a huge deal but would be nice if it was there already.
Same here, no npx with node 8.11.3. Nvm is 1.1.6
If I copy over the npx
and npx.cmd
files from C:\nvm\v8.11.4\node_modules\npm\bin
to C:\nvm\v8.11.4
then it seems to work. For some reason, I can't install node 8.12.0 using nvm, some download error.
I had same problem with node 8.12.0 not installing with nvm 1.1.5. In my case problem went away by upgrading to nvm 1.1.7. The npx install is working for me now too. (probably related, it looks like the official npm distribution folder paths have changed since nvm 1.1.6)
thanks @sullivanpt - upgrading to nvm 1.1.7 did the trick for me. I can now use npx without copying files over and can install node 8.12.0.
update: npx is working, but for some reason npx -v
returns the same version as npm -v
(https://github.com/coreybutler/nvm-windows/issues/395)
@epikhighs - you may have had an old/orphaned version of npx causing your issue. npm hard-coded permissions for removing npx/npm.cmd, making it impossible for version managers to remove the file. Once you remove by hand, it should work.
For anyone struggling with the same issue @briandesousa experienced, follow @sullivanpt's advice. npm changed their repo, which is a hard coded link in NVM4W. Upgrading will fix the issue.
Most helpful comment
Hi, it seems that this is still a problem.
I have a fresh install of nvm after which I installed both
[email protected] + [email protected]
and[email protected] + [email protected]
Doing
npx --version
givesnpx: command not found
for both.What happens if I
npm i -g npx
? Does this interfere with nvm management?Using Win7 64x.