# Cannot view 0.0.0.0:3000 in browser, and localhost:4000 gives error

**URL:** https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357
**Category:** Development
**Created:** [21 Marzo 2016, 9:36am UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357 "2016-03-21T09:36:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![GaurangTandon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gaurangtandon/32/52384_2.png) [@GaurangTandon](https://meta.discourse.org/u/GaurangTandon)
#### Post date: [21 Marzo 2016, 9:36am UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/1 "2016-03-21T09:36:52Z")

</div>

This is my cmd log:

```plaintext
intl@intl-PC /f/discourse (master)
$ vagrant ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.

intl@intl-PC /f/discourse (master)
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 3000 (guest) => 4000 (host) (adapter 1)
    default: 1080 (guest) => 4080 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.0
    default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => F:/discourse
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

intl@intl-PC /f/discourse (master)
$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation: https://help.ubuntu.com/
New release '14.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Welcome to your Vagrant-built virtual machine.
Last login: Sun Mar 20 07:47:34 2016 from 10.0.2.2
[vagrant@precise32:/vagrant (master)]$ bundle exec rails s -b 0.0.0.0
You are running an old version of bundler, please upgrade bundler ASAP, if you are using Discourse docker, rebuild your container.
You are running an old version of bundler, please upgrade bundler ASAP, if you are using Discourse docker, rebuild your container.
=> Booting Thin
=> Rails 4.2.6 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

```

Whenever I go to `0.0.0.0:3000`, it tells me:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/f/8f05b7549690ccc2e805da24a5ced8c8d6dc79ee.PNG)

**So, I tried `localhost:4000` (but that’s _not_ the url the cmd says), but this page now gives me a new error:**

```plaintext
ExecJS::RuntimeError in List#latest
Showing /vagrant/app/views/layouts/application.html.erb where line #29 raised:

SyntaxError: discourse/models/badge-grouping: Unexpected token (6:2)
  4 | export default RestModel.extend({
  5 | 
> 6 | @computed('name')
    | ^
  7 | i18nNameKey() {
  8 | return this.get('name').toLowerCase().replace(/\s/g, '_');
  9 | },
  (in /vagrant/app/assets/javascripts/discourse/models/badge-grouping.js.es6)
Extracted source (around line #45):
              
43 tags.html_safe
44 else
45 javascript_include_tag(*args)
46 end
47 end
48

Rails.root: /vagrant

Application Trace | Framework Trace | Full Trace

app/helpers/application_helper.rb:45:in `script'
app/views/layouts/application.html.erb:29:in `_app_views_layouts_application_html_erb__915713446_127392560'
lib/topic_list_responder.rb:15:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:11:in `respond_with_list'
app/controllers/list_controller.rb:85:in `block (2 levels) in <class:ListController>'
config/initializers/100-quiet_logger.rb:10:in `call_with_quiet_assets'
config/initializers/100-silence_logger.rb:26:in `call'
lib/middleware/missing_avatars.rb:21:in `call'
lib/middleware/turbo_dev.rb:33:in `call'

Request

Parameters:

None
Toggle session dump
Toggle env dump
Response

Headers:

None

```

_(also, when I get this error, my cmd automatically gets filled with hundreds of lines of code of `.scss`. Strange!)_

My path to getting vagrant set up seems to be pre-filled with obstacles which I don’t understand 😕 Please help me with this error. Thanks! 🙂

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [21 Marzo 2016, 4:31pm UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/2 "2016-03-21T16:31:56Z")

</div>

The correct port is 4000 (it’s 3000 inside vagrant and 4000 outside).

Looks like you got a error on Execjs, maybe because you’re on windows - which is strange because vagrant was supposed to solve this.

The `bundle install` goes fine?

---

<div class="post-metadata">

### Author: ![GlitchMr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/glitchmr/32/96700_2.png) [@GlitchMr](https://meta.discourse.org/u/GlitchMr)
#### Post date: [21 Marzo 2016, 5:22pm UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/3 "2016-03-21T17:22:34Z")

</div>

You don’t want to go to 0.0.0.0. That particular IP of a server means “any server”, which means the virtual machine listens to all IPs that belong to a computer (useful as a shortcut meaning if application doesn’t want to specify an IP it listens from), but you cannot access your virtual machine without VirtualBox bridge, which sets localhost port 4000 to redirect to port 3000 of your virtual machine.

You should use `localhost:4000` instead of `0.0.0.0:3000`

---

<div class="post-metadata">

### Author: ![GaurangTandon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gaurangtandon/32/52384_2.png) [@GaurangTandon](https://meta.discourse.org/u/GaurangTandon)
#### Post date: [21 Marzo 2016, 5:40pm UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/4 "2016-03-21T17:40:25Z")

</div>

> [@GlitchMr](#):
>
> You should use localhost:4000 instead of 0.0.0.0:3000

As I have said before, I have already used that:

> [@GaurangTandon](#):
>
> So, I tried localhost:4000 (but that’s not the url the cmd says). Anyway, I get to a page which gives the error:

but same error.

> [@Falco](#):
>
> The bundle install goes fine?

Yes, I have done `bundle install` and `bundle update` both.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [21 Marzo 2016, 9:30pm UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/5 "2016-03-21T21:30:53Z")

</div>

> [@GaurangTandon](#):
>
> and bundle update both.

That may be your problem.

The Discourse Gemfile and Gemfile.lock files have versions for some gems specified.  
Despite what vagrant may be telling you, I recommend you don’t manually upgrade any gems and let Discourse handle the versions.

Also, are you starting it up with  
`bundle exec rails s -b 0.0.0.0`

Then, as said point your browser to `localhost:4000`

---

<div class="post-metadata">

### Author: ![GaurangTandon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gaurangtandon/32/52384_2.png) [@GaurangTandon](https://meta.discourse.org/u/GaurangTandon)
#### Post date: [22 Marzo 2016, 2:31am UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/6 "2016-03-22T02:31:04Z")

</div>

> [@Mittineague](#):
>
> I recommend you don’t manually upgrade any gems and let Discourse handle the versions.

Unfortunately, I have already run `bundle update` ☹ Vagrant was constantly telling me:

> You are running an old version of bundler, please upgrade bundler ASAP…

And things weren’t working properly for me so maybe I thought this is the problem so I ran `bundle update`. Anyway to revert this to get things working properly?

And yes I am using bundle exec rails s -b 0.0.0.0 and localhost:4000

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [22 Marzo 2016, 3:28am UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/7 "2016-03-22T03:28:06Z")

</div>

> [@GaurangTandon](#):
>
> Anyway to revert this to get things working properly?

Unfortunately, if there is a way to “undo” or “rollback” I don’t know how.

I had a few false starts, each time getting a bit further. But what I did was uninstall GitHub, VirtualBox, and Vagrant paying more attention to things I might have missed before and trying things a bit different. (and yes, upgrading gems was one thing I tried)

The first “successful” attempt ran painfully slow. I believe it was because I installed everything directly under C and Windows had a security / privilege problem with that. At least I think that was why I had “sharing” problems.  
That, and I was opening the shell from the GitHub GUI

Then I upgraded to Windows 10 and everything broke, forcing me to try again.

This last time, which knock wood has been running well, I:

- installed GitHub - used all defaults

- installed VirtualBox - used all defaults

- installed Vagrant - used all defaults

- instead of putting my “work” under C I put it under  
C:/users/[me]/documents/virtualworkspace/discourse

- I open the shell from the Start menu - GitHub - Git Shell

- I don’t touch the GitHub or VirtualBox GUI

It takes a bit more effort cd’ing to the work folder, but Windows hasn’t complained yet.

---

<div class="post-metadata">

### Author: ![GaurangTandon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gaurangtandon/32/52384_2.png) [@GaurangTandon](https://meta.discourse.org/u/GaurangTandon)
#### Post date: [22 Marzo 2016, 4:47am UTC](https://meta.discourse.org/t/cannot-view-0-0-0-0-3000-in-browser-and-localhost-4000-gives-error/41357/8 "2016-03-22T04:47:57Z")

</div>

Thanks! 🙂 But I am a bit hesitant to try this fix, especially since it involves everything that I did ☹
