admin管理员组

文章数量:1289586

These are the statments i got after running the grunt serve mand from the directory sangam

C:\Users\Rohit\Documents\GitHub\sangam>grunt serve
Running "serve" task

Running "clean:server" (clean) task

Running "env:all" (env) task

Running "concurrent:server" (concurrent) task

Running "injector:scripts" (injector) task
Missing option `template`, using `dest` as template instead
Injecting js files (14 files)
>> Nothing changed

Running "injector:css" (injector) task
Missing option `template`, using `dest` as template instead
Injecting css files (5 files)
>> Nothing changed

Running "wiredep:target" (wiredep) task

Running "autoprefixer:dist" (autoprefixer) task

Running "express:dev" (express) task
Starting background Express server
Debugger listening on port 5858
module.js:327
    throw err;
    ^

Error: Cannot find module 'mongodb/node_modules/bson'
    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:\Users\Rohit\Documents\GitHub\sangam\node_modules\mongoose\lib\drivers\node-mongodb-native\objectid.js:8:16)
    at Module._pile (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)

Running "wait" task
>> Waiting for server reload...
Done waiting!

Running "open:server" (open) task

Running "watch" task
Waiting...

after running grunt serve , I get that error

"cannot find module 'mongodb/node_modules/bson'" ,

the localhost page opens , but I get " cant reach this page" , please help me with this

These are the statments i got after running the grunt serve mand from the directory sangam

C:\Users\Rohit\Documents\GitHub\sangam>grunt serve
Running "serve" task

Running "clean:server" (clean) task

Running "env:all" (env) task

Running "concurrent:server" (concurrent) task

Running "injector:scripts" (injector) task
Missing option `template`, using `dest` as template instead
Injecting js files (14 files)
>> Nothing changed

Running "injector:css" (injector) task
Missing option `template`, using `dest` as template instead
Injecting css files (5 files)
>> Nothing changed

Running "wiredep:target" (wiredep) task

Running "autoprefixer:dist" (autoprefixer) task

Running "express:dev" (express) task
Starting background Express server
Debugger listening on port 5858
module.js:327
    throw err;
    ^

Error: Cannot find module 'mongodb/node_modules/bson'
    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:\Users\Rohit\Documents\GitHub\sangam\node_modules\mongoose\lib\drivers\node-mongodb-native\objectid.js:8:16)
    at Module._pile (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)

Running "wait" task
>> Waiting for server reload...
Done waiting!

Running "open:server" (open) task

Running "watch" task
Waiting...

after running grunt serve , I get that error

"cannot find module 'mongodb/node_modules/bson'" ,

the localhost page opens , but I get " cant reach this page" , please help me with this

Share Improve this question edited Aug 5, 2017 at 10:08 Neil Lunn 151k36 gold badges355 silver badges325 bronze badges asked Jun 6, 2016 at 9:58 RohitB97RohitB97 4502 gold badges6 silver badges16 bronze badges 2
  • Refer the github-link – Shrabanee Commented Jun 6, 2016 at 10:03
  • i'm new to this, i went through the github link , but couldn't understand, can you please put it in simple words how to do it in windows cmd , ? @titi23 – RohitB97 Commented Jun 6, 2016 at 10:23
Add a ment  | 

4 Answers 4

Reset to default 4

As written in the github-issue try doing following steps:-

Make sure these two packages are at these versions

"mongodb": "^2.1.16", "mongoose": "^4.4.12"

npm install -g node-gyp 
cd /to/your/project-folder
rm -rf node_modules
npm install

Also try doing :-

do npm install inside node_modules/mongodb.

Hope this will help you.

Try changing mongoose 4.2.8 into to package.json and npm install again. It worked for me locally as well as on heroku.

what i did Just deleted node_modules folder and run

npm install

it worked fine.

Ensuring smooth operation, it is imperative to execute the following steps:

Install 'node-gyp' globally to facilitate native module pilation:

npm install -g node-gyp

Navigate to your project folder:

cd /to/your/project-folder

Perform a prehensive cleanup of the 'node_modules' directory:

rm -rf node_modules

Reinstall the necessary dependencies to guarantee optimal functionality:

npm install

By meticulously following these instructions, you pave the way for a seamless development experience.

本文标签: javascriptCannot find module 39mongodbnodemodulesbson39Stack Overflow