Hey there once again!
Is it true that the node_modules folder is not deleted on nuxt ssr projects? (or maybe ssr projects in general)
Is the node_modules folder needed in these cases?
We are experienceing disk space trouble which is caused by node_modules folders.
Any help is appreciated. Thanks!
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.
I see, thank you for clarifying!
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.
Ok, let me add one more idea to this:
How about a pool of deployment hooks like a library or something full of custom deployment hooks for reuse.
A community “store” with custom hooks.
Maybe i’m thinking too big here
We actually kind of have that - GitHub - cleavr/quick-scripts
It is not in-app but the idea is to once we have enough scripts, we could provide a UI to get it from within Cleavr without having to copy paste.
oh nice. Sorry to bother you then!
Looking forward to the future of cleavr