in pipelines: cache global npm modules?

image: node:6.9.4
pipelines:
default:
-
step:
caches:
-
node
-
globalnode
- usernode
script: # Modify the commands below to build your repository.
-
npm install -g firebase-tools
-
npm install
-
npm run build
-
firebase deploy --token=$FIREBASE_TOKEN --project ***** --non-interactive
definitions:
caches:
globalnode: /usr/local/lib/node_modules
usernode: $HOME/.npm

firebase-tools is not cached, but it is in "globalnode".

am I doing this wrong? 

 

1 answer

0 vote

Hi @Johan Blomgren,

the 'node' cache is one of the pre configured caches that we have set up. If you want to have additional caches like globalnode or usernode, you have to configure the paths there to those caches. 

More information is here in the 'Custom caches for other build tools and directories': https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html 

I did read the documentation, and the posted config is based on my findings.

Does not my config define a "globalnode" and a "usernode" -cache?

Is this not the way to configure the paths?

definitions: 
caches:
globalnode: /usr/local/lib/node_modules
usernode: $HOME/.npm

Sorry I missed that part. 

Currently environment variables in the directory paths are not supported so $HOME in the usernode path should be replaced with the actual file path. 

Can you check whether anything is cached inside the 'globalnode' cache (i.e. is just 'firebase-tools' not cached) ? 

If that would be the case, maybe there is an issue with symlinks (e.g. the firebase-tools directory could be a symlink in which case it might not be cached). 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,764 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you