Solution to node.js configuration problems

Under normal circumstances, when we configure global variables, there will be a problem npm WARN config global --global, --localare deprecated. Use `–location
Note: This configuration is to
create two folders [node_global] and [node_cache] in the installation directory for the global configuration 】Used to store cache information, etc.
After creating two empty folders, open the cmd command window and enter

npm config set prefix "Here is the path where you installed node.js\node_global"

npm config set cache "Here is the path where you installed node.js\node_cache"

But some will have this problem as shown in the figure:
insert image description here
Problem: npm WARN config global --global, --localare deprecated. Use --location=globalinstead.

problem causes

The global configuration of npm --global, --local is deprecated. Use --location=global instead.

Need to modify:
insert image description here

These two files need to be modified: change prefix -g in the file to prefix --location=global

insert image description here
insert image description here
After the change, there will be no problem in re-executing.

Guess you like

Origin blog.csdn.net/love7489/article/details/132145798