vscode執(zhí)行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:
解決辦法
注意:以下命令在終端執(zhí)行后,會在 C:\Users\用戶名 目錄下的.gitconfig文件中保存相應內容,如果某條內容報錯,可手動刪除.gitconfig中的內容后重新執(zhí)行。
方法1
在項目目錄下創(chuàng)建文件: .npmrc ,然后在里面添加如下內容:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org
接著在vscode的終端執(zhí)行如下命令:
git config --global url."https://github.com/nhn/raphael.git".insteadOf ssh://git@github.com/nhn/raphael.git
方法2
在項目目錄下創(chuàng)建文件: .npmrc ,然后在里面添加如下內容:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org
接著在vscode的終端執(zhí)行如下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
掛代理:在終端執(zhí)行如下兩條命令
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
方法4
在vscode(項目目錄)終端執(zhí)行如下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
執(zhí)行如下命令 將ssh 下載變成https:
git config --global url."https://".insteadOf ssh://git@
方法6
單獨下載
npm install --save raphael
佛系解決方法
npm install 多執(zhí)行幾次,或者換個時間執(zhí)行npm install文章來源:http://www.zghlxwxcb.cn/news/detail-691221.html
參考:npm install 報錯,怎么搞? 哪里問題? #3859文章來源地址http://www.zghlxwxcb.cn/news/detail-691221.html
到了這里,關于vscode執(zhí)行npm install 報錯(npm ERR! code 128...raphael.git...)的解決辦法的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!