Too long without output deleting node_modules folder


#1

Hi!

We’re using CircleCI 2.0, and lately, we’ve seen some jobs fail because deleting the node_modules/ folder takes too long without output:

https://circleci.com/workflow-run/31931c03-4b9a-4f2b-8f0f-4feecc555cc9
https://circleci.com/gh/decidim/decidim/134382

https://circleci.com/workflow-run/0701d371-2c68-4c0b-a7e3-0a638d322845
https://circleci.com/gh/decidim/decidim/133985
https://circleci.com/gh/decidim/decidim/133983

https://circleci.com/workflow-run/13b1e75e-4626-4ec3-8117-dfdbb7545d22
https://circleci.com/gh/decidim/decidim/133965

I don’t think >10min to delete a folder is reasonable.

Can we do something to help debug?


#2

Interesting problem. What is your workspace strategy here - cache the npm cache and get it to reinstall the dependencies without contacting the internet?

I wonder, if you are caching the whole of app/, could you write a Bash script to do your NPM install only if node_modules/ does not exist or is empty? I assume that once this is populated, you do not need to update it in any way, and the dependencies should not change over the jobs in your workflow?

(I appreciate this does not tackle the question about why deletes take such a long time, but it strikes me that even if you solve that problem, it would also be good to avoid unnecessary work, and so my approach would be a better solution).