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