While I am trying to use the global command with -g Just trying to install create a new react app with npm install -g command But I am facing the following warning: npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead in ReactJS. We are going to Learn about All Possible Solutions So Lets Get Start with This Article.
- How npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead Error Occurs?
- How To Solve npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead Error?
- Solution 1: Use --location=global
- Solution 2: Edit the Following files
- Solution 3: Using npm-windows-upgrade
- Conclusion
How npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead Error Occurs?
While I am trying to use the global command with -g Just trying to install create a new react app with npm install -g command But I am facing the following warning:
npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead.
So here I am writing all the possible solutions that I have tried to resolve this error.
How To Solve npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead Error?
- How To Solve npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead Error?
To Solve npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead Error Seems Like global –global, –local are deprecated as warning messages indicate But You can Use –location=global Command instead of global –global, –local are deprecated. Just Use This command in the Future. Use This Command: npm install –location=global create-react-app Instead of npm install -g create-react-app And Now, Your Warning message Must be solved. Thank You.
- npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead
To Solve npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead Error Seems Like global –global, –local are deprecated as warning messages indicate But You can Use –location=global Command instead of global –global, –local are deprecated. Just Use This command in the Future. Use This Command: npm install –location=global create-react-app Instead of npm install -g create-react-app And Now, Your Warning message Must be solved. Thank You.
Solution 1: Use –location=global
Seems Like global –global, –local are deprecated as warning messages indicate But You can Use –location=global Command instead of global –global, –local are deprecated. Just Use This command in the Future.
Use This Command
npm install --location=global create-react-app
Instead of
npm install -g create-react-app
And Now, Your Warning message Must be solved. Thank You.
Solution 2: Edit the Following files
You need to replace prefix -g with prefix –location=global in your npm, npm.cmd, npx, npx.cmd file.
- First Of All Open Your NodeJS Installation Directory. In most Of Case, Default Installation Directory is C:\Program Files\nodejs so Open this Directory.
- Then, Open npm, npm.cmd, npx, npx.cmd file This Four File In Your Editor I am Editing It In My VS Code Studio.

- Then, replace prefix -g with prefix –location=global in all four files.

- Just Save all Files and if asked save as administrator.
- And Now, Your error Must be solved. Thank You.
Solution 3: Using npm-windows-upgrade
- First Of All Open Your PowerShell With administrator Permission.
- Then Run Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

- And Then Install npm-windows-upgrade with the below Command.
npm install --global --production npm-windows-upgrade

- And Now, Update NPM to the Latest version with the help of the following command.
npm-windows-upgrade --npm-version latest
And Now, Your error will be solved. Thank You.
Conclusion
It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
- TypeError: Descriptors cannot not be created directly
- EvalError: Possible side-effect in debug-evaluate
- Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective
- node: /lib64/libm.so.6: version `GLIBC_2.27′ not found (required by node)
- Error: Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option points to an existing node module
thank you for solving my problem
It’s my Pleasure to Help You. Thank You For Your Valuable words.
Thank you very much for your complete guidance to resolve my issue. I spend more than one day searching online and applying different different solutions to fix that. But non of those worked for me. I was be able to fix that within 5 minutes with your clear guidance even I’m not much familiar with Command Prompt. Thank you…!
It’s my Pleasure to Help You Isuru Herath. Thank You So Much For Your Valuable words. It means me a lot.
thank youuuu!!!!!!!!!!!!! GRACIAS!! 😀 😀 😀 😀 😀 😀 greetings from Argentina
It’s my Pleasure to Help You Belen. Thank You So Much For Your Valuable words.
Thank’s! Your answer helps me!
It’s my Pleasure to Help You Slava. Thank You So Much For Your Valuable words.
it worked, thanks for the tutorial friend
It’s my Pleasure to Help You Murilo. Thank You So Much For Your Valuable words.
The last method worked perfectly for me, thank you very much, I spent the whole day discouraged looking for a solution.
It’s my Pleasure to Help You. Thank You So Much For Your Valuable words.