# Error code: ERR\_CONNECTION\_REFUSED running first node app on Vagrant OSX10.5

**URL:** <https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458>\
**Category:** Configuration\
**Created:** [October 18, 2014, 4:26pm UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458 "2014-10-18T16:26:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jochasinga](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/jochasinga/32/69_2.png) [@jochasinga](https://discuss.aerospike.com/u/jochasinga)\
**Post date:** [October 18, 2014, 4:26pm UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/1 "2014-10-18T16:26:10Z")

</div>

After following this intro here [http://www.aerospike.com/docs/client/nodejs/examples/node\_express\_aerospike.html](http://www.aerospike.com/docs/client/nodejs/examples/node_express_aerospike.html), I ran my first node app and got this error from my browser when browsing to [http://localhost:9000](http://localhost:9000)

Have anyone experienced that?

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [October 21, 2014, 10:47pm UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/2 "2014-10-21T22:47:46Z")

</div>

Hi Joe,

This error indicates that your web browser is unable to connect to the local Http web server over port 9000.

Are you running your Nodejs application within a VM, or Vagrant? Could you post the steps you did to start your application. Any other applications using port 9000? Also ensures that your application is running outside of the vagrant container.

best, –Lucien

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [October 21, 2014, 11:13pm UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/3 "2014-10-21T23:13:29Z")

</div>

Running the example on my mac book. I got the following:

1. Started Aerospike Vagrant in the Vagrant folder with `vagrant up`

2. Ran the ` **node app** ` command in the nodejs app folder.

3. Used Chrome browser to get the HTML form at [http://localhost:9000](http://localhost:9000)

---

<div class="post-metadata">

**Author:** ![jochasinga](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/jochasinga/32/69_2.png) [@jochasinga](https://discuss.aerospike.com/u/jochasinga)\
**Post date:** [October 22, 2014, 12:24am UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/4 "2014-10-22T00:24:09Z")

</div>

@lucien thanks for the response. Yes, I ran my node app from inside Vagrant’s aerospike centos-6.5 box, since that’s the option for MacOS no?

---

<div class="post-metadata">

**Author:** ![jochasinga](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/jochasinga/32/69_2.png) [@jochasinga](https://discuss.aerospike.com/u/jochasinga)\
**Post date:** [October 22, 2014, 12:25am UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/5 "2014-10-22T00:25:37Z")

</div>

@lucien yes I’ve got what you got up to step 2. Got the ERR\_connection\_refused from all browsers on step 3.

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [October 22, 2014, 12:58am UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/6 "2014-10-22T00:58:01Z")

</div>

@jochasinga, I think that’s the problem. You should run your _` **node app** `_ from outside the vagrant container on your main host. If you want to run it in vagrant you will need to enable port forwarding on port 9000 for your vagrant VM.

you can edit Vagrantfile in the vagrant folder and add the port forwarding info:

> # Create a forwarded port mapping which allows access to a specific port
> 
> # within the machine from a port on the host machine. In the example below,
> 
> # accessing “localhost:8080” will access port 80 on the guest machine.
> 
> config.vm.network “forwarded\_port”, guest: 9000, host: 9000

You basically have two options:

Option 1) Run the App from the main host and run only the database on vagrant VM.

Option 2) Run it all on the vagrant VM and enable port forwarding to be able to access Node app service over port 9000 from your web browser.

---

<div class="post-metadata">

**Author:** ![Prateek\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@Prateek\_kumar](https://discuss.aerospike.com/u/Prateek_kumar)\
**Post date:** [November 30, 2016, 6:54pm UTC](https://discuss.aerospike.com/t/error-code-err-connection-refused-running-first-node-app-on-vagrant-osx10-5/458/7 "2016-11-30T18:54:44Z")

</div>

I am using Windows 8.1 64 bits and also had the same problem (“ERR\_CONNECTION\_REFUSED”) that only happened on Google Chrome. On clicking on the “Detail” on the right of the error message, the problem lies with “127.0.0.1”, in my case. So I went to the settings and opened “Manage search engines …” box in the Search section, and while scrolling down, I saw that “Google Desktop, 127.0.0.1” was made a “Default”, so I switched over to Google as the default. Hope that might be of any help. [ERR\_CONNECTION\_REFUSED – Solutions Encyclopedia](http://www.deskdecode.com/err_connection_refused/)
