mongoose works fine on the computer
but on the server I get this error:
Error: Cannot find module './drivers'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:59:21)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/var/www/html/WTV.com/node_modules/mongoose/lib/schema.js:5:16)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
To solve the error "Cannot find module 'mongoose'", make sure to install the mongoose package by opening your terminal in your project's root directory and running the following command: npm i mongoose and restart your IDE and development server.
The can't find module 'mongodb' error occurs, if you're trying to access a mongodb module that is not present inside your node_modules folder. To solve the error install the mongodb module in your project root directory by running npm install mongodb .
OK! I took me a while but I found the solution
Good luck :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With