Issue in npm install from Concourse pipeline


I am using Concourse to clone, build and deploy an angular app to cf. The package.json file contains some dependencies from private github url of my organization. The npm install command in my build script is failing due to what seems to be SSH authentication issue to my private github repo. Can someone please help me with this as i am stuck and unable to move forward with this.

My pipeline config as follows (pipeline.yml):

- name: PR-Generate (Deploy to DEV)
    - myportal-dev

- name: deploy-dev
  type: cf
  check_every: 168h
    organization: MY_ORG
    space: MY_SPACE
    username: ((myuser))
    password: ((mypass))
- name: myportal-pr-gen
  type: pull-request
    repo: myrepo/myrepopath
    access_token: ((github-access-token.Key))
    only_mergeable: true
    base: develop
    require_review_approval: false
      - web/myportal/*
    private_key: |

- name: pull-request
  type: docker-image
    repository: jtarchie/pr

- name: myportal-dev
  public: true
  - get: repo
    trigger: true
    resource: myportal-pr-gen
    version: every
  - task: build
    privileged: true
      CONFIG_ENV: int
    file: repo/tasks/build.yml
  - put: deploy-dev
      manifest: repo/web/myportal/manifest.yml
      path: build-output/dist


platform: linux

  type: docker-image
    repository: node
  - name: repo
  - name: build-output
  path: sh
  - -exc
  - |
    set -e -u -x
    node --version
    npm --version
    npm install -g n   # Install n globally
    n 8.11.3          # Install and use v10.15.3
    node --version

    echo "Install Angular-CLI"
    npm install -g @angular/cli@6.0.8

    echo "Moving to myportal"
    cd repo/web/myportal 

    echo "Installing Packages"
    npm install -verbose

    echo "Build Angular Code"
    ng build --env=$CONFIG_ENV
    echo "Copying My Portal in output folder(exist on root)"
    cp -R ./dist ../../../build-output

Error that i am seeing in Concourse web console:

Successfully pulled node@sha256:12345a50ed624874dbbb17552ec4adb6f396f9abcd8d4.

  • set -e -u -x

  • node --version

  • npm --version

  • npm install -g n
    25h/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n

  • n@5.0.1
    added 1 package from 4 contributors in 0.362s

  • n 8.11.3

    installing : node-v8.11.3
    mkdir : /usr/local/n/versions/node/8.11.3
    fetch :
    installed : v8.11.3

  • node --version

  • echo Install Angular-CLI
    Install Angular-CLI

  • npm install -g @angular/cli@6.0.8
    25h/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

@angular/cli@6.0.8 postinstall /usr/local/lib/node_modules/@angular/cli
node ./bin/ng-update-message.js

25hnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

  • @angular/cli@6.0.8
    added 240 packages in 9.385s
  • echo Moving to myportal
    Moving to myportal
  • cd repo/web/myportal
  • echo Installing Packages
    Installing Packages
  • npm install -verbose
    npm info it worked if it ends with ok
    npm verb cli [ ‘/usr/local/bin/node’,
    npm verb cli ‘/usr/local/bin/npm’,
    npm verb cli ‘install’,
    npm verb cli ‘-verbose’ ]
    npm info using npm@5.6.0
    npm info using node@v8.11.3
    npm verb npm-session 3efcb8198b681dfd
    25hnpm info lifecycle myportal@1.1.0~preinstall: myportal@1.1.0
    The authenticity of host ‘ (12.345.67.88)’ can’t be established.ealTree
    ECDSA key fingerprint is SHA256:T95soGQxObRlTvmai/ld4nbNMM74BB1V4qenJzPL6d8.
    [ …] \ loadIdealTree:loadAllDepsIntoIdealTree: sill

My package.json contains dependencies on private modules as follows:

  "name": "myportal",
  "version": "1.1.0",
  "license": "UNLICENSED",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build-dev": "ng build -dev",
    "build-int": "ng build --env=int && gulp compress && gulp ad-int",
    "build-qa": "ng build --env=qa && gulp compress && gulp ad-int",
    "build-staging": "ng build --env=staging && gulp compress && gulp ad-int",
    "build-prod": "ng build -prod && gulp compress && gulp ad-prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  "private": false,
  "publishConfig": {
    "registry": ""
  "dependencies": {
    "@agm/core": "1.0.0-beta.5",
    "@angular-redux/store": "6.5.7",
    "@angular/animations": "7.2.7",
    "@angular/cdk": "7.3.2",
    **"mypackage.js": "git+ssh://",**

    "core-js": "2.4.1",
    "file-saver": "1.3.3",
    "font-awesome": "4.7.0",
    "hammerjs": "2.0.8",
    "intl": "1.2.5",
    "jquery": "3.2.1",
    "jquery-mapael": "git+",
    "ng2-charts": "^1.6.0",
    "ng2-google-charts": "^2.0.0",
    "ng2-search-filter": "^0.4.7",
    "os": "^0.1.1",
    "pace": "git+",

Thanks & Regards,

first hit on google:

I would suggest doing some more googling. It sounds like an NPM / git auth issue, not something specific to Concourse (sorry, I know that’s not the most helpful answer).

Hi @eedwards-sk yes i already went through that SO link and also google quite a bit. But not able to find any working solution. Here’s what i tried:

in build.yml added the following:

echo "SSH --"
ssh -o StrictHostKeyChecking=no git@12.345.67.88 "exit"

It gives error message as :
Permission denied (publickey).

So i tried to view the public key of the concourse server by adding the following:

cd ~/.ssh

But it gives error message as:

can’t cd to root/.ssh

Is there a way to view the public key of Concourse server or to add it to Github ?
Is there a concourse resource for doing npm install instead of using the shell script ?
Is this a known issue in Concourse when doing npm install on project that contains private dependencies? If yes then is there a work around or solution to do the ssh handshake between Concourse and github server ?

Thanks & Regards,

:thinking: You may need to start up an ssh-agent process and explicitly add the key to your keychain with ssh-add path/to/key.

Try adding this to your task script (assuming you’re passing a key somehow to the task):

eval $(ssh-agent)
trap "kill $SSH_AGENT_PID" EXIT

ssh-add path/to/key
1 Like