cnpm 安装之后找不到cnpm命令

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

猜你喜欢

转载自www.cnblogs.com/xybs/p/12682085.html