Fix MongoError on first connect

The default MongoDb port is 27017. An error occurs sometimes while I am running my Node & ExpressJS application, with the message:

message: 'failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED]' }

Several solutions are provided on the internet to fix this. But a lot of them did not work for me. The simplest method I find to fix this on MS Windows is:

1. Open your Command Prompt as administrator.
2. Type > net start mongodb

The mongodb service starts successfully.

Android Application Execution Error

Running my application in Android Emulator, I faced this error:

error:execution failed for task ':app:compiledebugjavawithjavac'.

My application got build up and ran in the emulator despite ignoring this issue. However, running it on my USB connected device was not a success.

Here’s how it is fixed. It demanded the environment variable JAVA_HOME to be set up. Open up your .bashrc file in your favorite editor. Add export JAVA_HOME="/path/to/your/jdk/installation" to the end of this file. I set the value to /usr/lib/jvm/java-1.8.0-openjdk-amd64. This set up the JAVA_HOME for me.

Next .gradle directory in the application directory needs to be deleted and then go to Build > Make Project in the Android Studio menu. This builds up the application’s fresh .gradle directory. And Run your application successfully.