Benjamin

静以修身,俭以养德,非澹薄无以明志,非宁静无以致远。
随笔 - 397, 文章 - 0, 评论 - 196, 引用 - 0
数据加载中……

npm WARN config global `--global`, `--local` are deprecated.解决过程实录

报错的原因是升级高版本 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
如果有多个版本可以升级,用上下箭头选择版本升级

posted on 2022-12-02 19:01 Benjamin 阅读(193) 评论(0)  编辑 收藏 引用 所属分类: 杂谈


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理