I've been following this tutorial to install Rocket.Chat on Ubuntu:
https://github.com/RocketChat/Rocket.Chat/wiki/Deploy-Rocket.Chat-without-docker
Everything looks good until I try to run the server with node main.js
:
Error: failed to connect to [localhost:27017]
at Object.Future.wait (/home/gregoire/Rocket.Chat/programs/server/node_modules/fibers/future.js:398:15)
at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
localhost
could also be 127.0.0.1
or my IP address, it doesn't change anything. Sounds like an error coming from MongoDB
.
So I tried to run with sudo
and the error I'm getting is different:
Error: MONGO_URL must be set in environment
I follow the tutorial, this variable has been set using export
:
export ROOT_URL=http://localhost/
export MONGO_URL=mongodb://localhost:27017/rocketchat
export PORT=80
EDIT:
I needed to start mongod
to then run the main.js
. But I also got an error:
mongodb failed to connect to 127.0.0.1
I made some research and found that I had a missing folder. I used this command to create it and then started mongod
:
mkdir -p /data/db
It worked after that, but it's not implied in the tutorial. I'm currently repeating the setup on a server and I'm having the same problem: /data/db
is missing.