npm安装 yarn和 taro 的小坑。

问题:无法通过校验

PS D:\taro> npm install -g yarn
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/yarn failed, reason: unable to verify the first certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-04-01T08_59_31_833Z-debug.log

解决:需要设置

npm config set strict-ssl false
npm install -g yarn

然后又问题:

无法查看yarn版本

Set-ExecutionPolicy : 无法绑定参数“ExecutionPolicy”。无法将值“RemoteSigned:”转换为类型“Microsoft.PowerShell.      
ExecutionPolicy”。错误:“无法将标识符名称 RemoteSigned: 与有效的枚举器名称相匹配。请指定以下枚举器名称之一,然后   
重试:
Unrestricted, RemoteSigned, AllSigned, Restricted, Default, Bypass, Undefined”
所在位置 行:1 字符: 21
+ set-ExecutionPolicy RemoteSigned:
+                     ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-ExecutionPolicy],ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SetExecutionPolicyComm  
   and

解决:

PS D:\taro> set-ExecutionPolicy RemoteSigned
PS D:\taro> get-ExecutionPolicy
RemoteSigned
PS D:\taro> Set-ExecutionPolicy -Scope CurrentUser

问题:

error An unexpected error occurred: "https://registry.yarnpkg.com/@tarojs%2fcli: unable to verify the first certificate".

 解决:
2017年2月27日,npm不再支持自签名证书。npm install走的是https协议,需要通过数字证书来保证的

 

npm config set registry http://registry.npm.taobao.org/

npm config set registry http://registry.cnpmjs.org/
npm list --depth=0 -global


一大堆的问题,最后发现全局安装,还是用npm .

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要使用npm安装yarn和cnpm,可以按照以下步骤进行操作: 1. 安装cnpm: 在命令行中运行以下命令: ``` npm install -g cnpm --registry=https://registry.npm.taobao.org ``` 这将通过npm安装cnpm,并使用淘宝镜像进行安装。 2. 临时使用cnpm安装模块: 在命令行中运行以下命令: ``` cnpm --registry https://registry.npm.taobao.org install express ``` 这将使用cnpm临时更改npm镜像,并使用cnpm安装express模块。 3. 永久切换到淘宝镜像: 在命令行中运行以下命令: ``` npm config set registry https://registry.npm.taobao.org npm config set disturl https://npm.taobao.org/dist --global ``` 这将永久更改npm的镜像设置为淘宝镜像,以提高下载安装模块的速度。可以使用以下命令验证是否成功: ``` npm config get registry ``` 应该返回淘宝镜像的地址。 4. 安装yarn: 在命令行中运行以下命令: ``` npm install -g yarn ``` 这将通过npm安装yarn。 现在,你已经成功使用npm安装yarn和cnpm。你可以根据需要使用它们来管理和安装模块。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [npmyarn,cnpm 的区别](https://blog.csdn.net/qq_34402069/article/details/127552443)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [npm、cnpmyarn安装与常用命令](https://blog.csdn.net/qq_40907977/article/details/105935943)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

东宇科技

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值