Fix npm warnings config global `–global`, `–local` are deprecated.
Overview
In this post, we will learn how to fix the following npm warnings config global `–global`, `–local` are deprecated. To install a package, we use the npm command. The warning message says that the flags are now deprecated.
Warning message
npm WARN config global `–global`, `–local` are deprecated. Use `–location=global` instead.
npm <command>
Fix
Steps to fix to remove the warning message are as follows:
Open File Explorer and browse to the Node.js install location.
By default, it’s under the directory:
C:\Program Files\nodejs
Open the npm.cmd bat file in a text editor of your choice. You need to have Administrative privileges on the machine to edit this file.
Replace the -g flag with the following:
–location=global
Save the file. Run the npm command. This will resolve the warning message.
That’s it. This would fix the warning message.