javascript - 致命的 : Could not read from remote repository npm install

标签 javascript

当我在 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/

相关文章:

javascript - 如何在不修改原始数组和创建副本的情况下替换数组元素?

javascript - Angular HttpModule 将 json 映射到实体列表

javascript - 运行 react-native run-android 时任务 ':app:transformClassesWithDexForDebug' 执行失败

javascript - 如何设置动态数据的css属性

javascript - 在小窗口或移动设备上查看时,我的 Bootstrap 固定顶部导航栏不会显示所有下拉元素

javascript - 如何根据坐标获取元素

javascript - 如何检查对象中的key是一个对象

javascript - react : Conditionally render a component in a route based on login status, 而不显示加载页面

javascript - Protractor 链式元素困惑

javascript - 即使有引用,GreaseMonkey setTimeout 也不起作用(FF4)