SyntaxError: discourse/models/badge-grouping: Unexpected token


(Pro Steve Smith) #1

Hola all. :grinning:

I’m getting started with Discourse As Your First Rails App and have run into some problems.

I got to step 4 and am able to get to http://localhost:4000/, but I see the following error on the page:

ExecJS::RuntimeError in List#latest
Showing /vagrant/app/views/layouts/application.html.erb where line #24 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)

This makes me thing that ES6 isn’t transpiling but I’m not sure.

Also, whenever I run bundle, I get the error: You are running an old version of bundler, please upgrade bundler ASAP, if you are using Discourse docker, rebuild your container.

I did go through the troubleshooting guide:

checking for hstore gets me this:

[vagrant@precise32:/vagrant (master)]$ psql
psql (9.4.1)
Type "help" for help.

vagrant=> \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description
---------+---------+------------+------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

How do I install hstore?

I ran bundle update, then discovered that I wasn’t supposed to run bundle update! I then ran bundle clean then bundle install. I’m still getting the same error.

rake db:migrate didn’t change things

I ran rake db:test:prepare and then rake spec, which got me a few errors. The most important of these is probably:

/var/lib/gems/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL:  database "discourse_test" does not exist (ActiveRecord::NoDatabaseError)

How do I update host_names in my database.yml (i.e. what do I put there)?

edit:
When I run redis-server I get the following:

[vagrant@precise32:/vagrant (master)]$ redis-server
1062:C 16 Feb 18:47:39.377 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1062:M 16 Feb 18:47:39.378 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
1062:M 16 Feb 18:47:39.379 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
1062:M 16 Feb 18:47:39.379 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
1062:M 16 Feb 18:47:39.379 # Creating Server TCP listening socket *:6379: bind: Address already in use

Not sure what to try next. Maybe there’s something in the docs or this forum about ES6 transpilation…


(Pro Steve Smith) #2

I have no idea why, but it’s working now. I did a vagrant destroy and followed the instructions and now I’ve got a working instance! :grin: