-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot find module 'mongodb/node_modules/bson' #2718
Comments
Works:
Maybe this should go into the official installation docs? tl;dr
|
Can anyone elaborate on this? I have this issue on both Mac and Linux instances. Thanks. P.S.
|
This also bit me today in deploying a mongoose app to Heroku. It seems Heroku was installing the 4.X mongoose while I still had 3.X locally. Heroku was getting this error on startup and I wasn't. Once I did 'npm update' to mongoose 4.X it started happening locally as well. I backed out to 3.X locally and on Heroku and now things are working again. |
I ran into the exact same issue as RationalGeek on a 100% fresh Heroku app. +1 for a better fix than rolling back mongoose |
What's the exact error message, with stack trace preferably? |
Thanks for looking into this, Valeri. Steps to reproduce1.) "rm -rf node_modules" inside main dir of our own project Stack Trace and Error messagehttps://gist.github.com/nottinhill/9851d558092f9d0149e3 Workaround1.) "npm install -g node-gyp" |
On Linux:
On OSX:
..then:
Works like a charm. |
Had to npm install inside node_modules/mongodb. Thanks for the help! |
@nottinhill Thanks for your help. Its working fine now. not giving me Error . Thanks |
@vkarpov15 It's giving me error again. Please Reopen this issue. Thank you |
What version are you using @gbansal7? |
It hit me today. |
@kuzirashi which version of mongoose? |
3.8.0, I fixed it with @BradZzz suggestion to:
|
That can help. You might also want to try upgrading to a more recent version :) |
I'm afraid I'll break my project. I'm happy with 3.8 working. :) |
If it works, that's fine. Future bug fixes are gonna require upgrading to higher versions of 3.8.x though :) |
I still have a problem with this on windows, using and npm3. |
@adrianw can you double check your version of mongoose and show me the output you get when you run it? It shouldn't be possible for you to get that error with 4.2.6, considering the fact that this particular require statement isn't in 4.2.6. |
@vkarpov15 I was definitely using 4.2.6, I did some more digging last after your reply and discovered it was actually triggered by using the extension/plugin 'mongoose-3x-types' which I've now removed from my project and everything is just perfect again. So if anyone else is still having problems it's worth checking plugins |
Saw this with v3.9.7, but rolling back to v3.8.12 seemed to work for now. Using latest NPM and node 4.2.4. |
Don't use 3.9.7. It's deprecated in npm for a reason: it was an unstable dev release from back when mongoose used to use linux kernel version numbering rather than semver. Use 3.8.x or 4.x. |
npm install mongoose@3.8.12 |
@dhirender-tyagi what does that comment refer to? |
Thanks @nottinhill, @nikola-kanacki - that resolved my issue (Error: Cannot find module './db.json' I did this: |
This is still a bug in like every damn version of this package, you can't use it with Node 6.x, you can't use any version prior to 4.x without it breaking and showing this error, what is going on here? Why is there not documented Readme notes? |
|
Hi guys, just a heads up as I was having all of these issues and nothing seemed to work. I'm sure you all probably read up on the docs but I didn't and missed out the part where you shouldn't include node_modules in your git push to the heroku app. This doc saved me https://devcenter.heroku.com/articles/troubleshooting-node-deploys |
Well that's fairly obvious. :) Even then though, this issue is ultra annoying. I don't see how a package like mongoose, which is used by thousands upon thousands of devs and projects, and backed by Automattic, can't get this shit sorted out. If there are strict requirements for versions, then PUT IT IN THE SHITTY DOCUMENTATION ON THE VERY FIRST PAGE. Google searching this issue finds about 5 pages of results of people asking the same damned question! And there is no definitive answer!!! |
Upgrading to the latest version of Mongoose and MongoDB worked for me. Though it did take some time to go through all the Mongoose changes in 4.x compared to 3.x! |
Are there a lot of breaking changes? The shitty thing is that my mongoose dependency is baked into Keystone js, so I can't easily bump that version. |
I have this issue with node 6.5.x , mongoose 4.4.x running Ubuntu 16, by switching to node 4.x it works. Question to you guys, now that node 6 will be the new LTS will it work? This seems a huge blocker if not fixed |
@molekilla have you tried |
Hi. |
i actually fix it with @BradZzz 's comment |
I am getting below issue, |
@kalburgimanjunath I don't see mongoose anywhere in your stack trace, why is this related to mongoose? |
@parth0595 it worked for me as well. Thanks |
I have this error since starting to develop with Mongoose 1,5 years ago.
The error never vanished completely, it comes back after each and every
npm update
This error has been a friend and annoyance alongside the road developing with MEANB.
Are there any plans to finally get rid of this error or will it continue to annoy the developer community until the end of all time :)?
The text was updated successfully, but these errors were encountered: