I recently encountered a similar problem. I use the MEAN stack with mongoose as my ODM and Heroku hosting:
Error: Cannot find module './drivers' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object.<anonymous> (/app/node_modules/mongoose/lib/schema.js:5:16) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Module.require (module.js:354:17) at Function.Module._load (module.js:301:12) at require (internal/module.js:12:17) Process exited with status 1 State changed from starting to crashed
In addition to setting NODE_MODULES_CACHE=false , as indicated here (under the "Cache Behavior" section), I had to remove my node_modules directory from the git repository (also recommended in Heroku docs). See this thread on how to remove a directory from git.
Also, adding a node_modules directory to your .gitignore file is a good idea. NOTE. This does not delete files from git, you still have to delete any previously committed files or directories that you want to ignore.
source share