Npm install package from private gitlab repository from inside a CI pipeline

Hi.

We have a number of nodejs packages that are dependant on some private libraries. All of these packages and libraries are hosted in the same private GitLab self hosted service.

What we are trying to do is run gitlab-ci tests on the services but we get errors during the npm install phase as we need an ssh key to install the private libraries. I found some information on doing something similar with submodules but I can’t find anything specific to nodejs and npm.

Example:

I have a project hosted at git@gitlab.example.com:js-libs/eg-parent-project.git
That has a dependency in the package.json that looks like "eg-child-library": "git+ssh://git@gitlab.example.com:js-libs/eg-child-library"

The ci pipeline then failed with the following error

$ npm ci
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git@gitlab.example.com:js-libs/eg-child-library
npm ERR! 
npm ERR! Host key verification failed.
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! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-10-23T12_18_23_448Z-debug.log

Thanks for any help