Hey!
We have been going back and forth on this. I think we include nodejs cleanup hook by default now. But you got to be careful with it in case you want to do rollbacks and pm2 restart and in some cases not having node_modules will break sites. I have it disabled for my site as after few deployments it get automatically deleted anyway.
If you don’t have a hook in your webapp already, you can add one with something like rm -rf node_modules. Make sure to add this hook at the very end of hooks list.
What are the circumstances under which the missing node_modules folder leads to errors i wonder.
When to expect the cleanup by default? Or did i misunderstand you?
For 1 Website we have like 2 to 3 Webapps (api, admin or frontend), each for stage and production which makes 6 webapps worst case for just a single website.
We have multiple websites with this so adding this deployment hook to 20-30 webapps is a bit cumbersome.
Maybe have an option switch in the global settings on which you can turn on “add clean up” hook or something?
I’ve run this issue only for one app in my experience, which is an Adonis 5 app. It is hard to tell, to be honest as we wouldn’t know what the app might be looking for. However, you can always test it yourself with a throwaway site/webapp - remove the folder and see what happens when you restart pm2 from within Cleavr and also try rollbacks and see how that behaves.
That’d be nice but it maybe a while before we make this feature available as we have few other things lined up that we’d like to get done. I don’t know if you want to wait for it. I wish there was another way but I’m afraid copy pasting is the only way that I know of.