解决cnpm install 遇到 unable to verify the first certificate 问题

    科技2024-12-04  48

    在使用 cnpm install 、npm install 安装项目依赖包时,遇到 unable to verify the first certificate(无法验证第一证书) 这一报错。

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

    解决方法:

    1、取消ssl验证:

    npm config set strict-ssl false 这个方法一般就可以解决了。

    2、更换npm镜像源:

    npm config set registry http://registry.cnpmjs.orgnpm config set registry http://registry.npm.taobao.org
    Processed: 0.011, SQL: 8