How do you fix this problem?
When i trying to install or check anything on command prompt. Node js through
npm WARN config global
--global
,--local
are deprecated. Use--location=global
instead
this error. For instance what can i do. I have little knowledge about node js if any one have any solution please help me.
CodePudding user response:
I see from your screenshot you are using npm ver 8.11.0. I believe the error you are seeing was an issue on that version that was fixed on npm ver 8.12.1
Can you try updating your npm to the most recent version? That should solve the warning.
CodePudding user response:
Backend Rule Now Gonna Solve npm WARN config global --global, --local are deprecated. Use --location=global instead
I think your Node.js command prompt is throwing this error to you don't worry I'll fix this error ► Node.js CMD Prompt Error
First of all open you c drive and explore your program file after that open node js folder.
Please look at this picture. This picture tells you a lot► Node.js Folder
Now you have to do open vs code or any code editor as a administrator ► In this image i explain which two file you need to edit
Okay now change npm file line number 23 prefix-g to prefix --location=global
View this image it's help you to understand ► How can you change npm prefix
Now you have to change another one npm.cmd file prefix
open npm.cmd file on your code editor and change line no 12 prefix-g to prefix --location=global
This image explain how can do this ► Change npm.cmd
If you have same problem in your npx then follow my instruction
1st open your npx file on your code editor ► Select This Two File
2nd Now start edit with only npx file like that ► npx file prefix set
3rd Now start edit npx.cmd file like that ► npx cmd prefix set