1、设置镜像源

npm install cnpm -g --registry=https://registry.npm.taobao.org

yarn config set registry https://registry.npm.taobao.org/

把C:\Users\ 用户名\AppData\Roaming\npm目录加入系统环境变量Path,然后重启即可。

cnpm 和yarn都可能会有以下提示:

yarn : File C:\Users\xxy\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this system. For more information

PowerShell yarn : 无法加载文件 C:\Users\Admin\AppData\Roaming\npm\yarn.ps1,因为在此系统因为在此系统上禁止运行脚本。
以管理员方式运行powershell


2:使用命令更改计算机的执行策略

PS C:\Users\Administrator> set-ExecutionPolicy RemoteSigned

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): y

3:查看执行策略

get-ExecutionPolicy

相关文章:

  • 2022-12-23
  • 2021-12-09
  • 2022-02-15
  • 2022-01-30
  • 2021-12-03
  • 2021-05-18
  • 2021-07-30
  • 2021-10-19
猜你喜欢
  • 2021-05-30
  • 2021-12-19
  • 2022-12-23
  • 2021-06-01
  • 2021-08-30
  • 2021-05-11
  • 2021-08-23
相关资源
相似解决方案