Reputation: 87
Good day everyone! I recently worked through this error message:
npm WARN config global --global, --local are deprecated. Use --location=global instead
by editing the 4 necessary files (npm, npm.cmd, npx, npx.cmd).
Problem is, now I can't install any dependency and I can't use npx (for example for npx create-react-app my-app
).
When trying to install a dependency
What I have tried so far:
npm cache clean –force
npm chache verify
npm-cache
folder under 'C:\Users\reaga\AppData\Local\
npm-cache
folder's location using npm config set cache C:\reaga\nodejs\npm-cache --global
On the flip side yarn seems to be working so I have no problems running yarn add express
for example. Any help would be very much appreciated!
Upvotes: -1
Views: 10270
Reputation: 19
The solution I followed to solve this problem:
1
- Go to folder C:\Program Files\nodejs
2
- You have to edit 4 files named : npm, npm.cmd, npx, npx.cmd
3
- Open the files in a text editor, like [ Visual Studio Code ]
4
- Replace prefix -g with prefix
with location=global
in all 4 files,
make sure didn't use -- and
Save all (if asked, save as administrator)
Like a picture.
Good to go!
Upvotes: 1