报错的原因是升级高版本 node 后,npm 没有同步升级,才导致出现 WARN。
npm install -g npm-windows-upgrade
npm-windows-upgrade
错误提示:Scripts cannot be executed on this system. To fix, run the command below as Administrator in PowerShell and try again: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
管理员运行PowerShell(win+x windows PowerShell(管理员))
控制台错误:.\npm-windows-upgrade.ps1 : File C:\Users\admin\AppData\Roaming\npm\npm-windows-upgrade.ps1 cannot be loaded. The file C:\Users\admin\AppData\Roaming\npm\npm-windows-upgrade.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting executio
n policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\npm-windows-upgrade.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
删除npm目录下文件名为ps1的文件再次运行.\npm-windows-upgrade
控制台提示:npm-windows-upgrade v6.0.1
Scripts cannot be executed on this system.
To fix, run the command below as Administrator in PowerShell and try again:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
PowerShell下执行Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force后再次运行npm-windows-upgrade
如果有多个版本可以升级,用上下箭头选择版本升级