You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was following instructions here for starting the server on localhost.
I never had mongo installed here before. Running npm run mongo:dev resulted in an error:
> [email protected] mongo:dev
> run-rs -v 5.0.23 -h -l ubuntu1804 --keep --dbpath mongodb-data --number 1 --quiet
Skipping purge
Running '/Users/rs-producepay/Documents/habitica/node_modules/run-rs/5.0.23/mongod' [ 27017 ]
Restarting replica set...
Error: Server is unavailable
at /Users/rs-producepay/Documents/habitica/node_modules/mongodb-topology-manager/lib/utils.js:79:40
at Socket.<anonymous> (/Users/rs-producepay/Documents/habitica/node_modules/mongodb-topology-manager/lib/utils.js:43:5)
at Socket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
I went googling around and found a workaround.
Posting it here to raise awareness about the issue and also in case anyone runs into it.
I've started changing the mongo:dev script in packages.json. I've added -h 127.0.0.1 to it, following a hint from this thread. The updated line in package.json now looks like this:
Then I hardcoded the mongo url above into the function getDevelopmentConnectionUrl in website/server/libs/mongodb.js. (Pretty nasty sorry)
return "mongodb://127.0.0.1:27017?replicaSet=rs";
npm run start went fine and no more troubles after that
> [email protected] start
> gulp nodemon
[17:24:10] Using gulpfile ~/Documents/habitica/gulpfile.js
[17:24:10] Starting 'nodemon'...
[17:24:10] Finished 'nodemon' after 13 ms
[17:24:10] [nodemon] 2.0.22
[17:24:10] [nodemon] to restart at any time, enter `rs`
[17:24:10] [nodemon] watching path(s): *.*
[17:24:10] [nodemon] watching extensions: js,mjs,json
[17:24:10] [nodemon] starting `node ./website/server/index.js`
2024-04-18T20:24:12.339Z - info Express server listening on port 3000
2024-04-18T20:24:12.347Z - info Connected with Mongoose.
I'll try to research deeper into this for a proper solution. Any hints would be appreciate!
The text was updated successfully, but these errors were encountered:
@ploissken Never tried the regular install of Habitica (I want to make it work using docker), but I found out that the mongoose version 7.6.3 is messing things up when using mongo5 (again, this is my observation for docker containers)
I would suggest switching mongoose to 5.13.22 in package.json
@diyoyo you are correct--we are running Node 20 and MongoDB 5.0.23 now. I'd recommend that @ploissken run npm ci to get a clean install of all the dependencies and try again--making changes to package.json and getDevelopmentConnectionUrl shouldn't be necessary!
General Info
Description
I was following instructions here for starting the server on localhost.
I never had mongo installed here before. Running
npm run mongo:dev
resulted in an error:I went googling around and found a workaround.
Posting it here to raise awareness about the issue and also in case anyone runs into it.
mongo:dev
script inpackages.json
. I've added-h 127.0.0.1
to it, following a hint from this thread. The updated line inpackage.json
now looks like this:"mongo:dev": "run-rs -v 5.0.23 -h 127.0.0.1 -l ubuntu1804 --keep --dbpath mongodb-data --number 1 --quiet",
/mongodb-data
npm run mongo:dev
again, the error is gone:getDevelopmentConnectionUrl
inwebsite/server/libs/mongodb.js
. (Pretty nasty sorry)npm run start
went fine and no more troubles after thatI'll try to research deeper into this for a proper solution. Any hints would be appreciate!
The text was updated successfully, but these errors were encountered: