npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. 怎么解决

img


npm WARN config global --global, --local are deprecated. Use --location=global instead. 怎么解决

将npm升级到最新版本即可
升级方法
1.在windows中以管理员身份打开cmd,然后执行命令
npm install -g npm-windows-upgrade
2.更改脚本策略
下载Windows Power Shell
然后以管理员身份运行,执行命令
set-ExecutionPolicy RemoteSigned

img


输入Y
成功更改脚本策略
3.在Windows Power Shell上运行命令
npm-windows-upgrade

问题解决!

其实此问题是由版本号导致
问题解决链接:
https://github.com/npm/cli/issues/4980
https://blog.csdn.net/weixin_42288182/article/details/106896534

同问

还是没人回答这个问题啊,楼主解决了吗?