Unable to initialize MongoDB! Is MongoDB installed

Solved Technical Support
  • 21/12 15:11 [18704] - error: Unable to initialize MongoDB! Is MongoDB installed? Error :Use of const in strict mode.
    21/12 15:11 [18704] - warn: NodeBB Setup Aborted.
    SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/root/nodebb/node_modules/connect-mongo/index.js:1:80)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

  • @feio did you install MongoDB?

  • @pichalite yes I'm using the tutorial located at: https://docs.nodebb.org/en/latest/installing/os/ubuntu.html.
    $ sudo apt-get install -y git nodejs mongodb build-essential.
    When I use redis everything works well.
    thx

  • @feio what do you get when you run these...

    npm ls mongodb
    npm ls connect-mongo

  • @pichalite said:

    npm ls connect-mongo

    I started the instalation from scratch, now using the answer from:
    https://community.nodebb.org/topic/7302/fatal-error-nan-h-no-such-file-or-directory
    after npm start and database configuration I received the message:

    make: Entering directory /root/nodebb/node_modules/mongodb/node_modules/kerberos/build' CXX(target) Release/obj.target/kerberos/lib/kerberos.o In file included from ../lib/kerberos.cc:1:0: ../lib/kerberos.h:5:27: fatal error: gssapi/gssapi.h: No such file or directory #include <gssapi/gssapi.h> ^ compilation terminated. make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1 make: Leaving directory /root/nodebb/node_modules/mongodb/node_modules/kerberos/build'
    gyp ERR! build error
    gyp ERR! stack Error: make failed with exit code: 2
    gyp ERR! stack at ChildProcess.onExit (/root/nodebb/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
    gyp ERR! stack at emitTwo (events.js:87:13)
    gyp ERR! stack at ChildProcess.emit (events.js:172:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
    gyp ERR! System Linux 3.13.0-71-generic
    gyp ERR! command "/usr/bin/nodejs" "/root/nodebb/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /root/nodebb/node_modules/mongodb/node_modules/kerberos
    gyp ERR! node -v v4.2.3
    gyp ERR! node-gyp -v v3.2.1
    gyp ERR! not ok
    [email protected] node_modules/connect-mongo

    so I ran: sudo apt-get install libkrb5-dev and finally ./nodebb start

    Now everything worked like a charm.

    Thx.


Suggested Topics