当我在 Mac 中运行 npm install 时:
sudo npm install --save umi/dynamic umi/link umi/navlink umi/redirect umi/router umi/withRouter
抛出这个错误:
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://git@github.com/umi/router.git
npm ERR!
npm ERR! git@github.com: Permission denied (publickey).
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!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dolphin/.npm/_logs/2019-09-10T01_52_01_900Z-debug.log
为什么npm install ssh访问github失败?我应该怎么做才能解决它?
最佳答案
当您在 package.json
文件中将 git 存储库列为依赖项时,就会发生这种情况。
"somepackage": "git://github.com/someorg/somerepo.git"
如果存储库是公共(public)
,将 URL 交换为 HTTP URL:
"somepackage": "https://github.com/someorg/somerepo"
如果存储库是私有(private)的,请在“项目设置”>“ checkout SSH key ”中启用用户 key 。参见 this document了解更多信息 。
关于javascript - 致命的 : Could not read from remote repository npm install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57864368/