0

I'm a beginner in nodejs and mongodb. I have been working on a project for a while using MEAN stack. It also uses mongojs and mongoose extentions which were working fine until now. I'm following this tutorial.

A server.js file helps me connect my project with the database. I'm getting the following mongodb error on running the server.js file which was not present until now.

        C:\Program Files\nodejs\easy-node-authentication-local1>node server1
    module.js:327
        throw err;
        ^

    Error: Cannot find module 'mongodb'
        at Function.Module._resolveFilename (module.js:325:15)
        at Function.Module._load (module.js:276:25)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (C:\ProgramFiles\nodejs\node_modules\mongojs\lib\collection.js:1:77)
        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)
        at Module.require (module.js:353:17)

I'm unable to install mongodb using 'npm install mongodb' because of the following error.

        C:\Program Files\nodejs>npm install mongodb
    npm ERR! fetch failed https://registry.npmjs.org/mongodb/-/mongodb-2.2.12.tgz
    npm WARN retry will retry, error on last attempt: Error: unable to verify the first certificate

Can anyone help me understand this problem.

4
  • Are you behind a corporate proxy or something? Commented Mar 2, 2017 at 19:15
  • No. It is a simple web application. I'm following this tutorial: github.com/michaelcheng429/meanstacktutorial. Commented Mar 2, 2017 at 19:34
  • I have made the edits. I would really appreciate your help. @JohnnyHK Commented Mar 3, 2017 at 14:54
  • Possible dupe of stackoverflow.com/questions/31673587/… Commented Mar 3, 2017 at 15:02

2 Answers 2

1

I do not understand the need of server.js for installing mongoDB.
But I recently tried installing, and it worked for me

make sure you have all dependencies installed.

I suggest you to npm install tar -g and then npm install mongodb -g

Sign up to request clarification or add additional context in comments.

Comments

0

have you any proxy in network? If yes you must configure with npm. Check this link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.