felixrieseberg/npm-windows-upgrade

Failed to upgrade

carpben opened this issue · 6 comments

I followed the instructions. Openning Powershell as admin:

  1. Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  2. npm install --global --production npm-windows-upgrade
  3. npm-windows-upgrade

I get the following message:

npm-windows-upgrade : The term 'npm-windows-upgrade' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ npm-windows-upgrade ....

This persisted after restarting the computer. Windows 10 version 1803, Node v 8.11.3, npm v 5.6.0

It looks like the folder npm's installs global stuff to is not on your path environmental variable(see npm-folders) . From powershell, if you run: dir $(npm -g bin) what is the output?

Mine is:

    Directory: F:\oo\bar\nvm\current\nodejs\nodejs


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       10/17/2018   4:51 PM                etc
d-----       10/17/2018   4:53 PM                node_modules
-a----       10/17/2018   4:50 PM       22963864 node.exe
-a----       10/17/2018   4:50 PM            833 npm
-a----       10/17/2018   4:52 PM            383 npm-windows-upgrade
-a----       10/17/2018   4:52 PM            260 npm-windows-upgrade.cmd
-a----       10/17/2018   4:50 PM            483 npm.cmd
-a----       10/17/2018   4:50 PM            833 npx
-a----       10/17/2018   4:50 PM            483 npx.cmd

then if I echo $env:Path, F:\oo\bar\nvm\current\nodejs\nodejs is on there. npm-windows-upgrade will be available to me to run in the current shell.

@virtuoushub, Sorry about the delay, and thanks for your reply!

I found a different solution to upgrade NPM.

In case it's still relevant, here is the result of running dir $(npm -g bin):

    Directory: C:\Users\carpb\AppData\Roaming\npm


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        7/26/2018  11:05 AM                etc
d-----       10/17/2018   2:15 PM                node_modules
-a----       10/17/2018   2:15 PM            341 create-react-app
-a----       10/17/2018   2:15 PM            218 create-react-app.cmd
-a----        7/31/2018   1:58 PM            345 firebase
-a----        7/31/2018   1:58 PM            222 firebase.cmd
-a----        9/24/2018   7:01 PM            383 npm-windows-upgrade
-a----        9/24/2018   7:01 PM            260 npm-windows-upgrade.cmd
-a----        7/29/2018   6:02 PM            327 serve
-a----        7/29/2018   6:02 PM            204 serve.cmd

When I run echo $env:Path I do find C:\Program Files\nodejs\;

d41z commented

@carpben How did you solve this problem?

It's been 6 months since I opened this issue. As far as I remember I found a different solution. I think I downloaded and installed node altogether, and it installed the latest version of NPM. @d41z

@d41z If you already have npm installed. Try "npm install -g npm@latest"

d41z commented

@carpben Ty for the reply! but finally i downloaded the last versión of node from web site.
SO: Windows 10.