Git Jenkins的npm安装无法安装bitbucket上托管的模块

Git Jenkins的npm安装无法安装bitbucket上托管的模块,git,jenkins,ssh,npm,credentials,Git,Jenkins,Ssh,Npm,Credentials,我正在使用Jenkins管理持续集成。我的一个作业包含以下任务: 使用凭证“BitBucket访问”(带有密码短语的私钥)=>通过Git插件从BitBucket克隆存储库可以正常工作 在存储库中执行批处理命令:'npm install'=>失败 在package.json文件中,有一些常见的nodeJS模块,如colors、fs.extra等。如果它们是唯一正确安装的模块,则这些模块是正确安装的 但BitBucket上还有一个作为私有模块托管的模块: "dependencies": {

我正在使用Jenkins管理持续集成。我的一个作业包含以下任务:

  • 使用凭证“BitBucket访问”(带有密码短语的私钥)=>通过Git插件从BitBucket克隆存储库可以正常工作
  • 在存储库中执行批处理命令:'npm install'=>失败
在package.json文件中,有一些常见的nodeJS模块,如colors、fs.extra等。如果它们是唯一正确安装的模块,则这些模块是正确安装的

但BitBucket上还有一个作为私有模块托管的模块:

"dependencies": {
    "module": "git+ssh://git@bitbucket.org/<team>/module.git"
}
“依赖项”:{
“模块”:“git+ssh://git@org//module.git“
}
在执行“npm安装”命令期间,该模块未能安装(请参阅下面的Jenkins日志)

该作业在Windows 7从机上运行。如果我尝试在从机上的会话“mySession”上进行“npm install”,它会要求我提供与位于C:\Users\mySession\.ssh\id_rsa的私钥相对应的密码短语(该密钥也具有BitBucket访问权限,但特定于会话“mySession”,因此与“BitBucket访问”凭据不同)。然后,“npm安装”通过安装模块正常结束

我尝试使用SSH代理插件,使用凭证“bitbucket访问”:它正确启动,但之后似乎没有使用,因为权限被拒绝

您对如何解决此问题并使“npm安装”正常工作有何想法

谢谢你的提问

詹金斯日志:

Construction à distance sur MySlave in workspace C:\Jenkins\workspace
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent]   Java/tomcat-native ssh-agent
[ssh-agent] Registered BouncyCastle on the remote agent
[ssh-agent] Started.
[ssh-agent] Using credentials bitbucket access

...

npm WARN package.json deployment@1.0.0 No description
npm WARN package.json deployment@1.0.0 No repository field.
npm WARN package.json deployment@1.0.0 No README data
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit 
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:203:12)
npm WARN addRemoteGit     at emitTwo (events.js:87:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:172:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:818:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:319:11)
npm WARN addRemoteGit     at emitOne (events.js:77:13)
npm WARN addRemoteGit     at Socket.emit (events.js:169:7)
npm WARN addRemoteGit     at Pipe._onclose (net.js:469:12)
npm WARN addRemoteGit  git+ssh://git@bitbucket.org/<team>/module.git resetting remote C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0
because of error: { [Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: Cloning into bare repository
'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0'...
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: Permission denied (publickey).
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: fatal: Could not read from remote repository.
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: 
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: Please make sure you have the correct access rights
npm ERR! git clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0: and the repository exists.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.3
npm ERR! npm  v2.14.7
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://git@bitbucket.org/<team>/module.git 
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0
npm ERR! Cloning into bare repository 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_git-remotes\ssh-git-bitbucket-org-<team>-module-git-2a4d53e0'...
npm ERR! 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! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

...

[ssh-agent] Stopped.
在工作区C:\Jenkins\workspace中构建沿MySlave的距离
[ssh代理]正在查找ssh代理实现。。。
[ssh代理]Java/tomcat本机ssh代理
[ssh代理]在远程代理上注册了BouncyCastle
[ssh代理]已启动。
[ssh代理]使用凭据bitbucket访问
...
npm WARN package.jsondeployment@1.0.0没有描述
npm WARN package.jsondeployment@1.0.0没有存储库字段。
npm WARN package.jsondeployment@1.0.0没有自述文件数据
npm WARN addRemoteGit错误:命令失败:git-c core.longpaths=true配置--get remote.origin.url
npm WARN addRemoteGit
ChildProcess.exithandler(child_process.js:203:12)上的npm WARN addRemoteGit
npm在emitTwo上警告addRemoteGit(events.js:87:13)
ChildProcess.emit(events.js:172:7)上的npm WARN addRemoteGit
位于maybeClose的npm WARN addRemoteGit(internal/child_process.js:818:16)
套接字处的npm WARN addRemoteGit。(内部/child_process.js:319:11)
emitOne上的npm WARN addRemoteGit(events.js:77:13)
位于Socket.emit(events.js:169:7)的npm WARN addRemoteGit
npm WARN addRemoteGit位于管道上。\u onclose(net.js:469:12)
npm WARN addRemoteGit git+ssh://git@bitbucket.org//module.git重置远程C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0
由于以下错误:{[error:命令失败:git-c core.longpaths=true config--get remote.origin.url
npm WARN addRemoteGit]
npm WARN addRemoteGit已终止:false,
npm WARN ADDMEROTEGIT代码:1,
npm WARN ADDMEROTEGIT信号:null,
npm WARN addRemoteGit cmd:'git-c core.longpaths=true config--get remote.origin.url'}
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0:克隆到裸存储库
'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0'。。。
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0:权限被拒绝(公钥)。
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git-bitbucket org--module-git-2a4d53e0:致命:无法从远程存储库读取。
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0:
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0:请确保您具有正确的访问权限
npm错误!git clone--template=C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git-bitbucket org--module-git-2a4d53e0:并且存储库存在。
npm错误!Windows NT 6.1.7601
npm错误!argv“C:\\Program Files\\nodejs\\node.exe”“C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js”“安装”
npm错误!节点v4.2.3
npm错误!npm v2.14.7
npm错误!代码128
npm错误!命令失败:git-c core.longpaths=true clone--template=c:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\\u templates--mirrorssh://git@bitbucket.org//module.git
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org--module-git-2a4d53e0
npm错误!克隆到裸存储库'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm cache\\u git-remotes\ssh git bitbucket org-
"dependencies": {
    "module": "git+https://x-token-auth:{access_token}@bitbucket.org/user/module.git"
}
sh "eval \$(ssh-agent); ssh-add /home/tomcat/.ssh/mysshkey; npm install"