node.js - npm 从 gitlab 安装模块

标签 node.js https npm installation gitlab

在 Node 模块 package.json 中我有:

"repository" : {
"type":"git",
"url":"https://git.domainName.com/Mastash3ff/someprojectname.git"
},

尝试通过 npm 安装。
尝试了各种命令,例如 https://docs.npmjs.com/cli/install :

npm install gitlab:git.domainName.com/Mastash3ff/someProjectName.git

也尝试过

npm 安装 https://git.domainName.com/Mastash3ff/someProjectName.git

按 Enter 键后 https://安装命令挂起。 npm install gitlab 命令吐出:

npm ERR! git clone --template=/home/Mastash3ff/.npm/_git-remotes/_templates --mirror git@gitlab.com:git.domainName.com/Mastash3ff%2FsomeProjectName.git /home/Mastash3ff/.npm/_git-remotes/git-gitlab-com-git-domainName-com-Mastash3ff-2FsomeProjectName-git-a88a1dff9012cf9dc7b0780cba303741: Cloning into bare repository '/home/Mastash3ff/.npm/_git-remotes/git-gitlab-com-git-domainName-com-Mastash3ff-2FsomeProjectName-git-a88a1dff9012cf9dc7b0780cba303741'...
npm ERR! git clone --template=/home/Mastash3ff/.npm/_git-remotes/_templates --mirror git@gitlab.com:git.domainName.com/Mastash3ff%2FsomeProjectName.git /home/Mastash3ff/.npm/_git-remotes/git-gitlab-com-git-domainName-com-Mastash3ff-2FsomeProjectName-git-a88a1dff9012cf9dc7b0780cba303741: Permission denied (publickey).
npm ERR! git clone --template=/home/Mastash3ff/.npm/_git-remotes/_templates --mirror git@gitlab.com:git.domainName.com/Mastash3ff%2FsomeProjectName.git /home/Mastash3ff/.npm/_git-remotes/git-gitlab-com-git-domainName-com-Mastash3ff-2FsomeProjectName-git-a88a1dff9012cf9dc7b0780cba303741: fatal: Could not read from remote repository.
.....

对于 gitlab,我们没有 ssh 身份验证设置,因此我们仅使用 https://。不知道为什么它会要求公钥。我们 git clone 的方式是将其指向 cert 文件。我的 ~/.npmrc 文件也指向:

  cafile=/home/Mastash3ff/git.someDomainName.com.cert

我没主意了。我希望这个问题可以通过指出不正确的 npm install 命令用法来解决:/

最佳答案

检查您对存储库的访问权限。

Permission denied (publickey)

关于node.js - npm 从 gitlab 安装模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34189321/

相关文章:

javascript - 在 Stylus 和 Node.js 和 Express 中使用本 map 片是否可行?

node.js - 如何编写测试来测试 Controller 和 api,以便我可以在不依赖数据库的情况下运行 PR 检查?

mysql - 使用 Node.JS 将 JSON 对象数据插入 MySQL

mysql - 将进程从 mysql 转换为 Redis

http - 带有 https 的奇尔卡特 HTTP

ssl - 为 nginx-ingress 配置 http(s) 时遇到问题

javascript - 为 Electron 安装模块时 Node 模块版本冲突

node.js - -save-dev 在 npm install grunt --save-dev 中是什么意思

node.js - 在 docker 中运行 npm update,而不使用该特定更新的缓存

java - 如何在java中测试http和https服务器的可用性