Adding new dependencies causes npm "cannot find module" error

The build works fine on heroku, and locally, and as a clean install.

Every time the build starts to run, I get the error, “Error: Cannot find module ‘rimraf’”

Looking through the npm install log, however, I see rimraf was installed. I added some new dependencies, and if I remove them, this stops breaking. However, I cannot replicate the issue on my staging server, locally or anywhere else. It only errors on here.

I’m using rimraf in a gulp file if that matters.


To verify that it was the other dependencies that were somehow causing this, I removed two dependencies I recently added and npm/gulp has no issue finding the dependencies now.