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

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

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 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: Beginners Guide to Install Discourse on macOS for Development 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.

Do you have any plugins installed?

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

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.


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

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.

PR in


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


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

-    pg (0.21.0)
+    pg (1.0.0)

Getting :slight_smile:

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 ```

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.


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

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


This does not seem to be you … but upstream.

So for the moment … just freeze the version and wait for open source to do its magic :slight_smile: