【npm 报错】WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

Environment: nodejs16 

Download link: https://nodejs.org/dist/v16.16.0/node-v16.16.0-x64.msi

How to install it will be followed by a tutorial. In short, it is very simple. The msi automatic and brainless installation under Windows is over. It is recommended not to change the original path (c drive path), and the personal test git will not recognize it.

Error content:


npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

To put it simply, the -g in the original configuration file is not supported. You need to manually change it to --location=global, mainly by modifying the following two files

It is recommended to use notepad++ or other code editing tools, do not use notepad and other system built-in tools, because the nodejs root directory permissions cannot be modified, the author uses vscode

Modify the following two parts:

 

 

Change the original sentence: 

prefix -g 
----更换为----
prefix --location=global

There is no need to restart the system, it will take effect immediately, and the npm command will not be reported again

Guess you like

Origin blog.csdn.net/weixin_56170314/article/details/125917962