Categories
JavaScript Answers

How to fix the “cannot find module ‘mongodb'” error with Node.js?

Spread the love

Sometimes, we want to fix the "cannot find module ‘mongodb’" error with Node.js.

In this article, we’ll look at how to fix the "cannot find module ‘mongodb’" error with Node.js.

How to fix the "cannot find module ‘mongodb’" error with Node.js?

To fix the "cannot find module ‘mongodb’" error with Node.js, we should install the mongodb module.

To install it globally, we run

npm install mongodb -g 

We can also install it locally by running

npm install mongodb 

after going into our Node.js project folder.

Conclusion

To fix the "cannot find module ‘mongodb’" error with Node.js, we should install the mongodb module.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *