How do I update path npx version?
Asked Answered
B

1

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
Bush answered 23/3, 2021 at 11:53 Comment(4)
Can you please enter this command. npm install -g npxSpirited
I already tried that as mentioned in the questionBush
this solution has been worked for me 1- sudo npm uninstall -g npx 2- sudo npm install -g npx for windows use terminal as administratorSpirited
nope didn't work for me eitherBush
I
15

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 [email protected] (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.

Immolate answered 17/5, 2021 at 19:48 Comment(1)
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. docs.npmjs.com/try-the-latest-stable-version-of-npmCachepot

© 2022 - 2024 — McMap. All rights reserved.