Error 'webpack: command not found'


Hey Glitch Team -

I added a new npm module to my project, and after installing started getting build errors in my logs /etc/app-types/node/ line 33: webpack: command not found.

I am not sure what happened. I removed the module I installed and could not get the error to go away. I also opened up the console, blew away node_modules and re-installed. No dice. Not sure where to go from here, and the app won’t work anymore on Glitch. I wound up exporting it and hosting on Firebase instead.

Glitch app:

Same app on Firebase:


Your app is private, so we can’t look at your code. I would expect that you have an error in package.json, or that your watch.json has a very high throttle value that made the install phase not run.


I just made it public. No big deal.

The weird thing is that it all worked locally instantly. I just exported it to GitHub, cloned it, ran npm i, and it all worked without changes.


you’re running out of space on the container. I’m sending you a PM with a possible fix :slight_smile:


I did some more digging, and I had set NODE_ENV=production in my .env file, which caused npm install --production to run, which of course excludes devDependencies, of which webpack was one. I changed this value to production before announcing it so that webpack would run in production mode (for React, minification, smaller JS build, etc.). I did not expect this to also change the npm install, so that was a bit unexpected. Regardless, it is resolved now.