Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipelines: cache custom node_modules folder

Do I understand correctly that pre-defined `node` cache only works when node_modules and package.json are located in the root directory of a project? Then how do I configure bitbucket-pipelines.yml to make cache work with node_modules folder located in subfolder (./public/node_modules/)? 

1 answer

1 accepted

6 votes
Answer accepted

Managed to solve it



- step
- node-custom
- if [ ! -d "node_modules" ]; then npm install; fi

node-custom: public/node_modules

Will that not cause problems if package.json is updated as the node_modules won't be re-generated once cached?

It will. You need to manually delete your cached dependencies using the UI.

There sure must be a way how to delete it automatically when package-lock.json changes?

@Petr Pelleractually, you don't need that line:

- if [ ! -d "node_modules" ]; then npm install; fi

Because the npm knows when to install/remove packages, I just changed this line by simply:

- npm install

And it works fine for me.

Like roman likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,894 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you