My app throws exeception for mongodb module not found.
I have application deployed on Ubuntu 16.04 with node js, mongodb, mongoose & express js. Until y'day my app was up and running with no issues. When I pushed the updates to server and restarted the server using pm2 it started giving below error :
Error: Cannot find module ‘mongodb’
at Function.Module.resolveFilename (module.js:325:15)
at Function.Module.load (module.js:276:25)
at Function.load (/usr/local/lib/nodemodules/pm2/nodemodules/pmx/lib/transaction.js:62:21)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/sumit/www/bulawaa/nodemodules/mongoose/lib/drivers/node-mongodb-native/binary.js:6:14)
at Module.compile (module.js:409:26)
at Object.Module.extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
I have mongoose npm package installed, trying to figure out what changed in mongodb drivers that is causing this issue. Due to this my app is down.
Can some one help me get to the cause. Look forward to hear from you.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.