8

When I run npx --version, it returns me v6.x.x

But after I do npm install -g npx, yarn global add npx, and it shows successful download of npx v10, running npx --version still returns me v6.x.x

Running where npx gives me:

C:\Program Files\nodejs\npx
C:\Program Files\nodejs\npx.cmd
C:\Users\Samson\AppData\Roaming\npm\npx
C:\Users\Samson\AppData\Roaming\npm\npx.cmd
RobC
  • 22,977
  • 20
  • 73
  • 80
Samson
  • 1,336
  • 2
  • 13
  • 28

1 Answers1

14

Ran into the same issue, this is what worked for me:

  1. Delete each one of the files listed in the output of where npx, for example del "C:\Program Files\nodejs\npx"

  2. Run npm uninstall -g npx

  3. Run npm install -g npx@10.2.2 (or whatever version you want to install)

After doing these steps, when I run npx --version I see the correct one, and the issue that required me to upgrade npx is fixed.

jbuhacoff
  • 1,189
  • 1
  • 13
  • 17
  • This could be related to a more broad issue with the way Windows installs node/npm. Windows defaults to the version of NPM installed in the nodeJS directory in program files rather than the one installed by npm install -g npm. It seems likely that this could also be true for NPX. https://docs.npmjs.com/try-the-latest-stable-version-of-npm – Patrick Gorman Dec 23 '22 at 18:56