You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Node.js 16.x遭遇git+SSH权限错误求助

Node.js 16.x升级后Jenkins流水线中npm安装内部Git依赖出现权限拒绝错误

环境信息

当前使用的第三方工具版本:

nodejs - 12.22.12
npm - 8.15.0
git - 1.8.3.1

尝试将Node.js版本升级至16.x(16.17.0或16.18.0),其他外部包版本暂未变动。

依赖配置

项目package.json中引用的内部依赖仓库配置如下:

"dependencies": {
   "<repository-name>" : "git+ssh://git@<org-repo-hub>/<path-to-repository>"
}

说明:上述<>仅为占位符,实际配置正确,且package-lock.json已同步更新。

问题现象

升级至Node.js 16.x后,在Jenkins CI/CD流水线执行npm install、npm ci或npm i时,持续出现权限错误:

[2022-10-10T18:32:09.295+0530]  + npm i
[2022-10-10T18:32:18.890+0530]  npm ERR! An unknown git error occurred
[2022-10-10T18:32:18.890+0530]  npm ERR! command git --no-replace-objects ls-remote ssh://git@<org-repo-hub>/<path-to-repository>
[2022-10-10T18:32:18.890+0530]  npm ERR! git@<org-repo-hub>/<path-to-repository>: Permission denied (publickey).
[2022-10-10T18:32:18.890+0530]  npm ERR! fatal: Could not read from remote repository.
[2022-10-10T18:32:18.890+0530]  npm ERR! 
[2022-10-10T18:32:18.890+0530]  npm ERR! Please make sure you have the correct access rights
[2022-10-10T18:32:18.890+0530]  npm ERR! and the repository exists.
  • 使用报错中的SSH链接,本地可通过git clone正常克隆该仓库。
  • 升级Node.js至15.x(15.14.0)时,保持其他配置不变,未出现任何认证错误。

已尝试的解决方案

  • 将依赖地址改为git::ssh://git@<org-repo-hub>/<path-to-repository>,问题依旧。
  • 使用HTTPS版本的仓库链接,仍出现权限问题。

寻求排查方向或解决方案,如需补充信息请告知。

内容的提问来源于stack exchange,提问作者user8909551

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 22:35:21