You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When invoking npm --version on Windows there is a warning about a deprecated commandline switch:
❯ npm --version
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.12.0
Expected Behavior
No warning when no deprecated switch is used.
Steps To Reproduce
After upgrading npm to version 8.12.0 with npm-windows-upgradenpm always shows a warning on every execution about the deprecated switch -g.
Environment
npm: 8.12.0
Node.js: 16.15.0
OS Name: Windows 11
Reacted by Thorbjørn Breum, Adam Charvát, Alt, Joe Chung, James Barrow, Tony Chiboucas, Ryan Walker, Piotr, Daniel García Paniagua, Badea Sabin-Codruț and 25 more
PS C:\> npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.12.1 👈
PS C:\>
Reacted by Gabrielle Dias, Andy, Vadim Vladimirovich, ilkergzlkkr, Adam Charvát, Maciej Kubień, Emmanuel Fernández de Lara, Felipe Távora, Fonny, createYourFirst and 24 more
Reacted by Felipe Távora and Anadi Joshua
Reacted by jonasbarcelona2022, Rohit Panwar and Varun Singh
npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.12.1
It is solved by editing C:\Program Files\nodejs\npm.cmd
on line 12
replacing prefix -g by prefix --location=global
Reacted by Denis Volchkov, Quentium, Adam Charvát, BlueCarp, -, Emmanuel Fernández de Lara, 要战便战, Brandon Bennett, Gabino Morales, MaTiuxS and 45 more
Reacted by Tony Chiboucas, Quentium, -, Emmanuel Fernández de Lara, 要战便战, Brandon Bennett, ShamRockWu, Julián Rosalen, BalaskaDIa, xingruxuewji and 8 more
Hi there, I had the same issue, this command solve the bug for me npm-windows-upgrade --npm-version latest
You have to run your powershell or cmd as administrator
Reacted by logico-philosophical, Getahune Alemayhu, iosdevadroitinfosol, SFConnect-info, Penny, Enis Necipoglu and Michele Locati
Reacted by Matt Mower, Jerahmeel Cosinas, z.o, Elijah, JAYJAYALLEN and Evgen
Reacted by ilkergzlkkr, Hussam Aldarwish, Prabhath Hettiarachchi, iosdevadroitinfosol, ArgianWimbang and Andrei Trifonov
you can try to set the commands that come here npm install --global --production npm-windows-upgrade
Running this command as admin command prompt should resolve this issue. I recommend you try on administrator cmd.
Reacted by orange2222222222, Michele Locati and XI
Reacted by Matt Mower, febinaghani, Jerahmeel Cosinas, jasp402 and Evgen
When invoking npm --version on Windows there is a warning about a deprecated commandline switch:
❯ npm --version
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.12.0
Expected Behavior
No warning when no deprecated switch is used.
Steps To Reproduce
After upgrading npm to version 8.12.0 with npm-windows-upgradenpm always shows a warning on every execution about the deprecated switch -g.
Environment
npm: 8.12.0
Node.js: 16.15.0
OS Name: Windows 11
**This worked for me,
Run CMD as Administrator:
C:/WINDOWS/system32>npm-windows-upgrade --npm-version latest
npm-windows-upgrade v6.0.1
Checked system for npm installation:
According to PowerShell: C:\Program Files\nodejs
According to npm: C:\Users\Admin\AppData\Roaming\npm
Decided that npm is installed in C:\Program Files\nodejs
Upgrading npm.../
Upgrading npm (fallback method)... |
Upgrade finished. Your new npm version is 8.12.2. Have a nice day!
I just upgraded npm by opening C:\Program Files\nodejs as administrator in PowerShell and running npm install npm. No more warnings during version check.
Activity
AlttiRi commentedon Jun 2, 2022
Same with
npm8.11.0 after installing Node.js v18.3.0. (Node.js v18.2.0 does not have this problem.)Using of
npxalso shows the warning.nlf commentedon Jun 2, 2022
we've reverted this deprecation in v8.12.1, so i'm closing this issue. thanks for the reports!
yury-tyshkevich commentedon Jun 2, 2022
Not solved!
PowerShell
adazmy commentedon Jun 2, 2022
Issue still there on 8.12.1
It is solved by editing C:\Program Files\nodejs\npm.cmd
on line 12
replacing
prefix -gbyprefix --location=globalGitSkelly commentedon Jun 2, 2022
Is there a way to re-open this issue or will updates keep coming through this feed?
I too am having this issue still on 8.12.1.
weezyade commentedon Jun 2, 2022
I'm having the same issue......on both versions
Dany-GP commentedon Jun 3, 2022
Hi there, I had the same issue, this command solve the bug for me
npm-windows-upgrade --npm-version latestYou have to run your powershell or cmd as administrator
Gino16 commentedon Jun 3, 2022
Issue is still here in npm 8.12.1 version:
$ npm -vnpm WARN config global --global, --local are deprecated. Use --location=global instead.8.12.1👀Dany-GP commentedon Jun 3, 2022
Did you opened command prompt as Administrator? What OS are you running npm? @Gino16
Gino16 commentedon Jun 3, 2022
I used Git Bash, my OS is Windows 10, its the same result when I open in cmd as Administrator @Dany-GP
Dany-GP commentedon Jun 3, 2022
you can try to set the commands that come here
npm install --global --production npm-windows-upgradeRunning this command as admin command prompt should resolve this issue. I recommend you try on administrator cmd.
54 remaining items
Leandro-FM commentedon Jun 13, 2022
Leandro-FM commentedon Jun 13, 2022
OK! ok!.. UHUHUHUHHUH.. Obrigado!
Leandro-FM commentedon Jun 13, 2022
// Resolvido
PS C:\WINDOWS\system32> 8.12.1
PS C:\WINDOWS\system32> PS C:\WINDOWS\system32>^C
PS C:\WINDOWS\system32> 8.12.1
PS C:\WINDOWS\system32> npm -v
8.12.1
PS C:\WINDOWS\system32>
ashifbabu commentedon Jun 13, 2022
Finally works 👍 :) Thanks
IMDanijel commentedon Jun 17, 2022
**This worked for me,
Run CMD as Administrator:
C:/WINDOWS/system32>npm-windows-upgrade --npm-version latest
npm-windows-upgrade v6.0.1
Checked system for npm installation:
According to PowerShell: C:\Program Files\nodejs
According to npm: C:\Users\Admin\AppData\Roaming\npm
Decided that npm is installed in C:\Program Files\nodejs
Upgrading npm.../
Upgrading npm (fallback method)... |
Upgrade finished. Your new npm version is 8.12.2. Have a nice day!
C:\WINDOWS\system32>npm -v
8.12.2
arantisi commentedon Jul 2, 2022
im having this issue as well what do i do ?

flensrocker commentedon Jul 3, 2022
As Administrator run
yangjunran commentedon Jul 6, 2022
woorykim commentedon Jul 27, 2022
npm i -g npm-windows-upgradenpm-windows-upgrade(feat. @Hashsudo - Thanks! UHUH~~~~ Thank for you solve!🧙♂️)
snebjorn commentedon Oct 12, 2022
Is the official fix for this error to run the following?
Or will this be fixed in via an update? So we can just run
npm i -g npmflensrocker commentedon Oct 12, 2022
@snebjorn As I understand the installation of npm on Windows,
npm i -g npmwill never work, see the official documentation.npm-windows-upgrade is the way to go.
HucklJS commentedon Dec 11, 2022
I just upgraded npm by opening
C:\Program Files\nodejsas administrator in PowerShell and runningnpm install npm. No more warnings during version check.Replace --location=global with --global.
Replace --location=global with --global.
Replace --location=global with --global.