# Error on Fresh install: MiniRacer::RuntimeError: ReferenceError: setTimeout is not defined

**URL:** https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663
**Category:** Self-hosting
**Created:** [January 10, 2018, 12:47pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663 "2018-01-10T12:47:23Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 10, 2018, 12:47pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/1 "2018-01-10T12:47:23Z")

</div>

For the life of me I can’t get it to install. Everything is fine. But when I try to run migrations I get

```plaintext
MiniRacer::RuntimeError: ReferenceError: setTimeout is not defined
JavaScript at <anonymous>:4927:23
JavaScript at internalRequire (<anonymous>:60:16)
JavaScript at internalRequire (<anonymous>:56:24)
JavaScript at internalRequire (<anonymous>:56:24)
JavaScript at requireModule (<anonymous>:93:14)
JavaScript at <anonymous>:19312:92
JavaScript at <anonymous>:19315:2
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:182:in `eval_unsafe'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:182:in `block (2 levels) in eval'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:262:in `timeout'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:181:in `block in eval'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:69:in `block in with_lock'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:69:in `synchronize'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:69:in `with_lock'
/app/.global/gems/mini_racer-0.1.15/lib/mini_racer.rb:179:in `eval'
...
pp/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/app/.global/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/app/.global/gems/seed-fu-2.3.7/lib/seed-fu/runner.rb:35:in `run_file'
/app/.global/gems/seed-fu-2.3.7/lib/seed-fu/runner.rb:26:in `block in run'
/app/.global/gems/seed-fu-2.3.7/lib/seed-fu/runner.rb:25:in `each'
/app/.global/gems/seed-fu-2.3.7/lib/seed-fu/runner.rb:25:in `run'
/app/.global/gems/seed-fu-2.3.7/lib/seed-fu.rb:29:in `seed'
/app/lib/tasks/db.rake:30:in `block in <top (required)>'
/app/.global/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

```

This around == Seed from /app/db/fixtures/006\_badges.rb

Test on my local machine ruby 2.4.2p198 (2017-09-14 revision 59899) [x86\_64-darwin17]  
and on Platform.sh ruby 2.4.3p205 (2017-12-14 revision 61247) [x86\_64-linux]

Happens on current master (8ad6d8385b01ee7cd4f8b6820135d05fc63db6ea) on 1.9 stable and on 2.0-beta

Already referenced here: [Install Discourse on macOS for development - #132](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-mac-os-x-macos-for-development/15772/132) but giving it its own special issue.

Not doing anything special I can think of. I `bundle install` configure the database and that’s about it.

Any help or pointers in resolving this would be much appreciated.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 10, 2018, 8:54pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/2 "2018-01-10T20:54:59Z")

</div>

Do you have any plugins installed?

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 11, 2018, 9:35am UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/3 "2018-01-11T09:35:42Z")

</div>

None. This is a fresh initial clean install with nothing at all.

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 11, 2018, 12:29pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/4 "2018-01-11T12:29:39Z")

</div>

OK Now I understand what happens. This is because of a `bundle update`. Using the original Gemfile.lock this behaviour does not appear.

I will try to track down which updated Gem breaks this so it can be expressed in the version constraints in the Gemfile.

---

<div class="post-metadata">

### Author: ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)
#### Post date: [January 12, 2018, 2:48pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/5 "2018-01-12T14:48:24Z")

</div>

I have the same error with Discourse 2.  
For now, I use `git reset --hard v1.9.1` as a workaround.

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 12, 2018, 3:53pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/6 "2018-01-12T15:53:34Z")

</div>

OK nailed it down.

locking down :  
`gem 'pg', '~> 0.21.0' `  
`gem 'ember-source', '2.13.3' `

should allow you to run `bundle update` and not die. Opening a pull request.

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 12, 2018, 4:00pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/7 "2018-01-12T16:00:09Z")

</div>

PR in [Lock down gem versions so bundle update can be run by OriPekelman · Pull Request #5491 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/5491)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 12, 2018, 9:16pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/8 "2018-01-12T21:16:31Z")

</div>

Wait I totally get the need to lock ember, but why pg?

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 16, 2018, 4:49pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/9 "2018-01-16T16:49:59Z")

</div>

As far as I can see PG seems to blow-up as well.  
A bundle update here is going to jump very far :

```diff
- pg (0.21.0)
+ pg (1.0.0)

```

Getting 🙂

````plaintext
16:49:00 worker.1 | /app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
16:49:00 worker.1 | from /app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec'
16:49:00 worker.1 | from /app/.global/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection'
16 ```
````

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [January 17, 2018, 6:20pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/10 "2018-01-17T18:20:27Z")

</div>

> [@Ori\_Pekelman](#):
>
> A bundle update here is going to jump very far

That not as big as it looks. 1.0.0 was the next release after 0.21.0. They bumped the major version because it dropped support for Ruby \< 2.0 and PostgreSQL \< 9.2.

[https://bitbucket.org/ged/ruby-pg/raw/b8d08d4347d564b7ad89c2f3cb26bbdf05dcfe3b/History.rdoc](https://bitbucket.org/ged/ruby-pg/raw/b8d08d4347d564b7ad89c2f3cb26bbdf05dcfe3b/History.rdoc)

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 22, 2018, 2:19pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/11 "2018-01-22T14:19:41Z")

</div>

Yup, I saw that after. Big or small jump … it still breaks. See error message above…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 22, 2018, 10:36pm UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/12 "2018-01-22T22:36:42Z")

</div>

Yeah we got to get this fixed, not working on latest pg is a problem.

---

<div class="post-metadata">

### Author: ![Ori\_Pekelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ori_pekelman/32/124402_2.png) [@Ori\_Pekelman](https://meta.discourse.org/u/Ori_Pekelman)
#### Post date: [January 23, 2018, 9:02am UTC](https://meta.discourse.org/t/error-on-fresh-install-miniracer-runtimeerror-referenceerror-settimeout-is-not-defined/77663/13 "2018-01-23T09:02:14Z")

</div>

This does not seem to be you .. but upstream.

[https://github.com/rails/rails/issues/31673](https://github.com/rails/rails/issues/31673)

So for the moment .. just freeze the version and wait for open source to do its magic 🙂
