Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:38:11+00:00 2026-06-17T04:38:11+00:00

I am going through my first node.js project. I’ve installed mongodb, have a server.js

  • 0

I am going through my first node.js project. I’ve installed mongodb, have a server.js file, and when I try to run it I get this error

module.js:340
    throw err;
         ^
Error: Cannot find module 'mongodb'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)

I am quite certain I have mongodb installed, I am new to unix coming from a C# windows background, but I think this is a path not being configured properly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:38:13+00:00Added an answer on June 17, 2026 at 4:38 am

    The error you are getting indicates that the NPM package for MongoDB is not correctly installed.

    The fix here depends on how you plan to leverage NPM. The NPM package manager operates has two different modes of operation: local and global.

    The first (and default) mode is “local”.

    If you go to the folder with server.js you will see a sub-folder named node_modules. Under that folder will be a mongodb folder. If that folder is not present, then the mongodb module is not installed on that path.

    To correct this, cd to that folder and type npm install mongodb. When the process is done you should have the node_modules/mongodb folder available.

    You can also install MongoDB package globally using npm install -g mongodb. This is useful if you are using lots of node.js command-line stuff, but less useful if you are deploying the whole thing.

    Side Note: there is an evolving standard around package.json. The package.json is a standardized way of including all dependencies for a given module. This allows you to run npm update or npm install at the root of a project / package and effectively “pull in” all of the dependencies. This greatly simplifies the deployment process and the process of keeping your dependencies in-line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While going through some tutorials, I have encountered lines such as this: ((IDisposable)foo).Dispose(); Ignore
I was going through this link: FAT16 Basics to Assemble Clusters . I have
I was going through this article, i have one particular doubt if some one
I am new to backbone and trying out my first app after going through
I'm going back through one of my old apps (my first, actually), and am
Going through happstack-lite tutorial : we build functions that have return type of ServerPart
Going through the microsoft authentication tutorial listed here they have you create a master
While going through SWig generated wrappers, I find that the PInvokes don't have any
Okay, I'm going to try to simplify this example as much as possible. Here's
So I'm going through the first chapter of How To Design Programs 2nd Edition.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.