Make sure /node_modules is in your .gitignore file.
I'm not using Envoyer but I do use Forge and DigitalOcean and with a few sites online, none of them have the node_modules folder on the server.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am throwing this in Envoyer because its related. So I have a really basic Laravel 5.3 site. Totally static. Nothing fancy happening. Here is my package.json
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"laravel-elixir": "^6.0.0-9",
"laravel-elixir-browsersync-official": "^1.0.0",
"laravel-elixir-imagemin": "^0.2.3"
}
}
That seemingly simple package.json creates a node_modules folder that is 130MB on disk, and a tree that numbers in the thousands. What. The. Hell.
First off that is grotesque. I don't even know what to say.
Second, I am running Envoyer for the production version of the site, and obviously every deploy will generate 130MB of node_modules. So I am thinking of adding a hook to remove the node modules at the end of each deployment. The only purpose of node modules is to let gulp do its thing so I don't see this causing any huge issues but just wanted to open the discussion and see if anyone has any thoughts on this. Just wanted to see if anyone has any thoughts.
Just to follow up I have just added rm -r node_modules to my post activation hook in Envoyer and it seems to be just fine. Easy fix.
But node_modules is still gross.
Please or to participate in this conversation.