Strictly Programming

npm install modules from bitbucket private repositories

Posted in Uncategorized by sqllyw on 10/17/2015

You might have private repositories in bitbucket and you declare dependencies in your nodejs app’s package.json:
"dependencies": {
"ejs": "1.0.0"

when you do a npm install, you will be prompted to enter password twice, after entering the password, installation will proceed, this might work or might not work at all.

A simple approach as follow:

1) turn on git cache, keep password in the cache for a certain period of time:
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
2) access the private repo once, answer password when prompted:
git ls-remote

now you can install packages:

npm install --production

or all
npm install
Tagged with: , ,