npm ERR! command git ls-remote ssh://git@github.com/hyj1991/v8-profiler-next.git

npm 安装 v8-profiler-next时报错

v8-profiler-next是一个用于剖析nodejs性能的插件,可获取cpu性能堆栈,采集内存快照,官方版本是 node-profiler,但是无法安装,并且似乎无人维护,因此使用v8-profiler-next

报错内容:

npm ERR! code 128
npm ERR! command failed
npm ERR! command git ls-remote ssh://git@github.com/hyj1991/v8-profiler-next.git

在这里插入图片描述

解决方案

  • 问题1. . 我使用的是https协议从github下载安装的库,并没有配置ssh相应的key,而在gitlab-ci中使用了ssh协议去下载,那么应该将ssh协议改为https协议:
    可以在执行npm install指令前,执行以下指令:

    将url中的字符串进行替换
    git config --global url.“https://”.insteadOf ssh://git@

    会将 ssh://git@github.com 替换成 https://github.com,就变成http协议下载了;

  • 问题2. 国内访问github有时候比较慢,所以可以换成淘宝镜像进行下载
    再执行一个指令:

    git config --global url.“github.com.cnpmjs.org”.insteadOf github.com

    会将 https://github.com 替换成 https://github.com.cnpmjs.orj,相当于是从淘宝的github镜像进行下载了;满速起飞

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值