当前位置: 首页 > news >正文

vscode执行npm install 报错(npm ERR! code 128...raphael.git...)的解决办法

文章目录

  • vscode执行npm install 报错(npm ERR! code 128)的解决办法
    • 问题详情
    • 解决办法
      • 方法1
      • 方法2
      • 方法3
      • 方法4
      • 方法5
      • 方法6
      • 佛系解决方法

vscode执行npm install 报错(npm ERR! code 128)的解决办法

问题详情

报错信息如下:

npm install
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
npm ERR! command-line line 0: unsupported option "accept-new".
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:

解决办法

注意:以下命令在终端执行后,会在 C:\Users\用户名 目录下的.gitconfig文件中保存相应内容,如果某条内容报错,可手动删除.gitconfig中的内容后重新执行。

方法1

在项目目录下创建文件: .npmrc ,然后在里面添加如下内容:

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org

接着在vscode的终端执行如下命令:

git config --global url."https://github.com/nhn/raphael.git".insteadOf ssh://git@github.com/nhn/raphael.git

方法2

在项目目录下创建文件: .npmrc ,然后在里面添加如下内容:

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org

接着在vscode的终端执行如下2条命令:

git config --global url."https://github.com/nhn/raphael.git".insteadOf ssh://git@github.com/nhn/raphael.git
git config --global url."https://github.com/adobe-webplatform/eve.git".insteadOf ssh://git@github.com/adobe-webplatform/eve.git

方法3

挂代理:在终端执行如下两条命令

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

方法4

在vscode(项目目录)终端执行如下2条命令:
git --no-replace-objects ls-remote https://github.com.cnpmjs.org/nhn/raphael.git
git --no-replace-objects ls-remote https://github.com.cnpmjs.org/adobe-webplatform/eve.git

方法5

执行如下命令 将ssh 下载变成https:

git config --global url."https://".insteadOf ssh://git@

方法6

单独下载

npm install --save raphael

佛系解决方法

npm install 多执行几次,或者换个时间执行npm install

参考:npm install 报错,怎么搞? 哪里问题? #3859

相关文章:

  • 深度学习炼丹-超参数设定和网络训练
  • 使用小爱同学语音控制电脑关机 - Winform C#
  • 左值和右值
  • 【LeetCode题目详解】(一)27.原地移除元素、88.合并两个有序数组
  • 【檀越剑指大厂—Nginx】Nginx篇
  • Nacos配置管理
  • 【C进阶】第十篇——数据在内存中的存储
  • Qt实现全局鼠标事件监听器-Windows
  • 基于LEACH和HEED的WSN路由协议研究与改进(Matlab代码实现)
  • JDBC连接数据库详解~
  • 【Docker】解决Docker创建Tomcat容器实例后访问Tomcat主页时报HTTP状态404-未找到的错误
  • GitLab安装与卸载
  • Python编程 圣诞树教程 (附代码)程序员的浪漫
  • 冰雪旅游热开启!IU酒店与您畅游山水之间
  • 详解vue中watch的用法
  • CH36X系列接口芯片Linux系统开发库说明
  • 为什么char a[]的a不能用a=“hello”来赋值?
  • SpringBoot简单优雅实现图片上传功能(超详细)
  • SpringBoot整合Mybatis-Plus分页失效
  • 10.每天进步一点点---Python-Requests HTTP 请求库-2
  • 上海“模速空间”:将形成人工智能“北斗七星”和群星态势
  • 深入贯彻中央八项规定精神学习教育中央指导组派驻地方和单位名单公布
  • 打工人的“小长假模式”,已经迫不及待地开启了
  • AI观察|算力饥渴与泡沫
  • 【社论】优化限购限行,激发汽车消费潜能
  • 国家卫健委:工作相关肌肉骨骼疾病、精神和行为障碍成职业健康新挑战