We are having a nodejs repository in our application which is currently using the below versions of the third party packages -
nodejs - 12.22.12
npm - 8.15.0
git - 1.8.3.1
There are few other external packages being used but may not be relative here(if required to find the issue, can add them later). And, we are trying to upgrade the nodejs version to 16.x (16.17.0 or 16.18.0) version.
We are using another internal repository as one of the dependent libraries inside this project written in package.json file like below -
"dependencies": {
"<repository-name>" : "git+ssh://git@<org-repo-hub>/<path-to-repository>"
}
Note: The <> used above, are just for reference.
and the same is created/updated accordingly in package-lock.json file as well. After upgradation to nodejs 16.x, when we try to build it from Jenkins CICD pipeline with npm install or npm ci or npm i, we are constantly getting this error -
[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.
With the ssh link shown in error above ssh://git@<org-repo-hub>/<path-to-repository> , we are able to clone the same repository in local with git clone command.
Alternatives tried -
- We have tried with
git::ssh://git@<org-repo-hub>/<path-to-repository>instead ofgit+ssh://git@<org-repo-hub>/<path-to-repository>, but still no luck. - We have tried with https version of the same git link, but got the same permission issue.
On the other hand, the upgrade of nodejs from the available 12.22.12 version to 15.x (15.14.0) is success without any authentication error, keeping other external packages versions and the code used as constant.
We couldn't understand, why are we getting the authentication error only during upgrade to 16.x?
Any help or support or way forward would be really appreciated. Please let me know in case any other information is required. Thanks in advance.