安装nodejs报错:Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

  1. 安装nodejs版本为node-v16.16.0-x64.msi,安装完成后执行node -v命令老是提示警告命令: npm WARN config global --global, --local are deprecated. Use --location=global instead.

  2. 根据百度提示npm 没有同步升级到对应版本,所以出现 WARN

  3. 安装npm-windows-upgrade: npm install -g npm-windows-upgrade

  4. 执行npm-windows-upgrade命令,提示:Scripts cannot be executed on this system;此时需要打开Windows管理员下的PowerShell窗口执行:Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force或Set-ExecutionPolicy Unrestricted -Scope CurrentUser,然后再执行npm-windows-upgrade,选择最新的npm进行安装即可.

  5. 使用cnpm,首先cmd全局安装npm install -g cnpm --registry=http://registry.npmmirror.com,然后就可以cnpm了.

posted @ 2022-08-06 14:22  文采杰出  阅读(423)  评论(0编辑  收藏  举报