npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
时间: 2023-10-08 11:11:11 浏览: 52
This warning message is related to the deprecation of the `--global` and `--local` flags in npm. These flags were used to specify whether a package should be installed globally or locally.
Instead of using these flags, npm suggests using the `--location` flag with the value of either `global` or `local`. For example, to install a package globally, you can use the following command:
```
npm install <package> --location=global
```
This warning message is just a reminder that the old flags are now deprecated and should no longer be used.
相关问题
npm WARN config global --global, --local are deprecated. Use --location=global instead.
该警告是因为在使用npm -v命令时,使用了已经弃用的--global和--local选项。现在应该使用--location=global选项来代替它们。要解决这个问题,可以按照以下步骤进行操作:
1. 找到node的安装路径。
2. 打开命令提示符或终端窗口,并输入以下命令:
```
npm config set location global
```
3. 运行上述命令后,再次运行npm -v命令,应该不会再出现警告信息了。
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. 8.11.0
在使用npm时,如果出现“npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.”的报警,这是因为npm已经弃用了`--global`和`--local`选项,而是使用了`--location=global`选项。因此,您可以使用以下命令来避免这个警告:
```
npm config set location global
```
这将设置npm的全局位置为全局安装,而不是本地安装。如果您想在本地安装模块,可以使用以下命令:
```
npm config set location local
```
请注意,这些命令需要管理员权限才能运行。