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.

Rashmi
  • 5
  • 4

2 Answers2

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

Yash Karanke
  • 764
  • 1
  • 15
  • 29
0

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