Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Pipelines not working with NPM image and SSH Keys

Mike Stumpf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2019

Hello, I followed the instructions here and here to get a bitbucket pipelines yaml file set up, create a SSH key for the private repo running the build and setting that SSH key as an access token on the private repo being included in the build but I am unable to authenticate successfully. Is this a limitation with the node image or is my configuration incorrect?

 

bitbucket-pipelines.yml

# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.1

pipelines:
pull-requests:
develop:
- step:
caches:
- node
script: # Modify the commands below to build your repository.
- npm install
- npm test

 

package.json

{
...,
"dependencies": {
...,
"private-package": "git+https://bitbucket.org/{projectName}/{repoName}.git#v0.7.3",

 

npm install

+ npm install
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://bitbucket.org/{projectName}/{repoName}.git
npm ERR!
npm ERR! remote: Invalid username or password
npm ERR! fatal: Authentication failed for 'https://bitbucket.org/{projectName}/{repoName}.git'
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-03-08T14_12_45_712Z-debug.log

 

repo running pipeline build Screenshot 2019-03-08 at 10.41.28.png

 

private repo being included in pipeline build

Screenshot 2019-03-08 at 10.42.20.png

1 answer

1 accepted

1 vote
Answer accepted
mwatson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2019

It looks like you're using the https version of the git url - you need to go into Bitbucket and select "clone" and then select the "ssh" url and use that in your package.json.

Mike Stumpf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2019

that was the issue, it's working now. thank you!

Like Alberto Suarez - Zartis likes this
Alberto Suarez - Zartis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 7, 2020

thanks so much! I am finally able to npm pull & install from pipeline.

I had another problem, if I replace the https url on package.json with a ssh one... then I wont be able to do npm install on my local computer ( access denied error )... any thoughs? thanks!! 

Oscar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 11, 2021

Try this:

"dependencies": {

  "private-package": "bitbucket:<owner>/<repo>"

}

Source: https://mskutta.github.io/2018/05/25/private-npm-packages-in-bitbucket/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events