【发布时间】:2016-01-29 03:13:31
【问题描述】:
我正在尝试安装一个从我们的私人仓库中提取的 npm 包。当我以自己的身份运行 npm install 时,我得到 Please try running this command again as root/Administrator. 当我以 sudo 身份运行它时,我得到 p>
npm ERR! Error: Command failed: 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.
我通常不使用 sudo 来进行 npm 安装。我认为问题是当我以 sudo 运行时,它正在 /var/root/.ssh 中查找密钥。我没有 root 用户凭据,否则我会以 root 身份创建一个新密钥。还有其他解决方法吗?
编辑:尝试了以下建议,但没有奏效。但是,有问题的 repo 由包根目录下的依赖项引用。 `./node_modules//package.json。如果我将 git url 更改为使用 http,它可以工作,但这样做不是一个好主意,因为当我将包检回 repo 时,我必须更改它。
【问题讨论】: