Npm install of github dependencies failing in bitbucket build

I have a project I’m attempting to setup with the Beta version of Bitbucket support.

One of my package.json looks like so:
{ "name": "skynet-ui", "version": "1.12.0-3", "private": true, "description": "Skynet", "dependencies": { "glob": "^4.0.0", "gulp": "^3.8.11", "gulp-concat": "^2.4.1", "gulp-eslint": "^2.0.0", "gulp-file-blocks": "https://github.com/cthrax/gulp-file-blocks", "gulp-html2js": "^0.2.0", "gulp-imagemin": "^1.2.1", "gulp-less": "^3.0.3", "gulp-load-plugins": "^0.7.1", "gulp-minify-css": "^0.3.11", "gulp-ng-annotate": "^0.5.2", "gulp-replace": "^0.5.0", "gulp-sourcemaps": "^1.2.8", "gulp-uglify": "^1.0.1", "gulp-util": "^3.0.1", "js-yaml": "^3.3.1", "karma": "=0.13.22", "karma-chai-plugins": "https://github.com/cthrax/karma-chai-plugins", "karma-coverage": "^0.1.5", "karma-junit-reporter": "*", "karma-mocha": "^0.2.2", "karma-ng-html2js-preprocessor": "^0.1.0", "karma-phantomjs-launcher": "~0.1.4", "karma-spec-reporter": "0.0.13", "lazypipe": "^0.2.2", "merge-stream": "^0.1.6", "mocha": "~2.4.5", "sinon": "^1.12.2", "yargs": "^1.3.3" }, "files": [], "devDependencies": { "byline": "^4.1.1", "connect-prism": "https://github.com/cthrax/connect-prism", "del": "^1.1.1", "grunt": "~0.4.1", "gulp-bower": "0.0.7", "gulp-bower-normalize": "^1.0.6", "gulp-connect": "^2.2.0", "gulp-phraseapp": "^1.1.0", "gulp-print": "*", "gulp-protractor": "0.0.11", "gulp-rename": "^1.2.2", "graceful-fs": "4.1.4", "karma-chrome-launcher": "^0.2.1", "karma-common-js": "^0.2.2", "main-bower-files": "^2.4.0", "ng-describe": "^1.8.0", "opn": "^1.0.0", "protractor": "^3.2.2", "through2": "^0.6.3", "vinyl": "^0.4.5", "webdriver-manager": "^1.0.0" } }

My circle.yml looks like so:
`## Customize the test machine
machine:

timezone:
America/Denver # Set the timezone

Version of ruby to use

node:
version: 6.2.2

python:
version: 2.7.10

Override /etc/hosts

hosts:
circlehost: 127.0.0.1

services:
- redis

Add some environment variables

environment:
CIRCLE_ENV: test
PYTHONPATH: {PYTHONPATH}:{HOME}/google_appengine
GCLOUD_PROJECT: websitu-dev

Customize dependencies

dependencies:
pre:
- curl -o $HOME/google_appengine_1.9.30.zip https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.30.zip # install appengine apk
- unzip -q -d $HOME $HOME/google_appengine_1.9.30.zip # unzip to home dir, so that python path matches
- echo GCLOUD_SERVICE_KEY | base64 --decode > {HOME}/gcloud-service-key.json # Get the google key somewhere we can use it
- sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update # Update google components
- sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
- sudo /opt/google-cloud-sdk/bin/gcloud config set project $GCLOUD_PROJECT
- pip install --upgrade pip # Ensure pip is upgraded
- npm install:
pwd:
ui
- npm install:
pwd:
admin-portal/ui
- pip install -r requirements.txt

Customize test commands

test:
override:
- python …/buildtools/mtox/mtox/mtox.py:
pwd:
skynet-common
- python …/buildtools/mtox/mtox/mtox.py:
pwd:
appengine-common
- python …/buildtools/mtox/mtox/mtox.py:
pwd:
skynet-utilities
- python …/buildtools/mtox/mtox/mtox.py:
pwd:
TubeProxy
- python …/buildtools/mtox/mtox/mtox.py:
pwd:
api
- gulp:
pwd:
ui
- gulp:
pwd:
admin-portal/ui

`

When running I get down to the NPM install and get the message:

`cd "ui"
npm install
npm WARN deprecated gulp-minify-css@0.3.13: Please use gulp-clean-css
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: Cloning into bare repository ‘/home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071’…
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: Warning: Permanently added the RSA host key for IP address ‘192.30.253.113’ to the list of known hosts.
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: Permission denied (publickey).
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: fatal: Could not read from remote repository.
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071:
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: Please make sure you have the correct access rights
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071: and the repository exists.
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd: Cloning into bare repository ‘/home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd’…
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd: Permission denied (publickey).
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd: fatal: Could not read from remote repository.
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd:
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd: Please make sure you have the correct access rights
npm ERR! git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/karma-chai-plugins.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-karma-chai-plugins-git-1354f1fd: and the repository exists.
npm ERR! Linux 3.13.0-91-generic
npm ERR! argv “/home/ubuntu/nvm/versions/node/v6.2.2/bin/node” “/home/ubuntu/nvm/versions/node/v6.2.2/bin/npm” "install"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code 128

npm ERR! Command failed: git clone --template=/home/ubuntu/.npm/_git-remotes/_templates --mirror https://github.com/cthrax/gulp-file-blocks.git /home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071
npm ERR! Cloning into bare repository ‘/home/ubuntu/.npm/_git-remotes/git-https-github-com-cthrax-gulp-file-blocks-git-6ad0c071’…
npm ERR! Warning: Permanently added the RSA host key for IP address ‘192.30.253.113’ to the list of known hosts.
npm ERR! Permission denied (publickey).
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!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/skynet/ui/npm-debug.log

cd "ui"
npm install
returned exit code 1

Action failed: npm install`

I know the FAQ suggests changing dependencies to https dependencies, but as you can see, I’ve already done that. Is there maybe a configuration for bitbucket that forces the use of public keys? Or some other global git configuration that needs to be set/unset?

Any help would be greatly appreciated.

I believe you have to use the full path, such as https://github.com/cthrax/gulp-file-blocks.git

Ref: http://stackoverflow.com/a/17509764

Thanks for the reply!

I had believed that to be the case as well. In fact, when I first started converting to circleci that was exactly how I had the dependencies listed. This is the latest iteration of several changes, based on what the circleci faq had listed.

The iterations were something like the following:
git+https://github.com/cthrax/gulp-file-blocks.git#master
git+https://github.com/cthrax/gulp-file-blocks.git


All with the same error message. Which surprised me a little because you’ll note the error message refers https://github.com/cthrax/gulp-file-blocks.git, which was true in all permutations.

I have re-run all these permutations without cache just to be sure. It’s really got me stumped.

For reference, here’s the FAQ I’m referring to https://circleci.com/docs/git-npm-install/

This appears to be a possible Issue with the BitBucket beta, I would advised emailing them at beta@circleci.com to open a ticket.

For reference, here is the package.json build under BitBucket.

:build_failed: https://circleci.com/bb/drazisil/fun-with-circle/2

Here is the same build working under GitHub:

:build_success: https://circleci.com/gh/drazisil/fun-with-circle/196

@KunalJain

Thanks for following up and the examples! I’ll send off the email and hopefully we can get to the bottom of this.

1 Like

We have fixed the issue where git clone was failing for Bitbucket repositories. Please let us know if you are still facing issues.

1 Like

Thanks @KunalJain ! I am still unable to get my build working. Just to clarify the issue appears to be around cloning github repositories via NPM. I can add more log messages to this if needed, but they are the same as posted above.

This problem should be fixed now. Please us know if you are still facing issues. Thank you so much for your patience.