inesita-rb / inesita

Frontend web application framework in Ruby using Opal.
https://inesita.fazibear.me/
MIT License
259 stars 15 forks source link

uninitialized constant Router::Counters in clean Inesita install #46

Closed lachlancotter closed 4 years ago

lachlancotter commented 4 years ago

Steps

Installed Inesita using the instructions here:

$ gem install inesita
$ inesita new inesita_app
$ cd inesita_app
$ bundle exec inesita server

Pointed browser to http://localhost:9292

Expected result

Expected to see the base demo app render in the browser.

Actual result

Browser renders nothing. JS console shows this error:

kernel.rb:1070
Uncaught
    .   $NameError {name: "Counters", message: "uninitialized constant Router::Counters", stack: "Counters: uninitialized constant Router::Counters"}
    .   message: "uninitialized constant Router::Counters"
name: "Counters"
stack: "Counters: uninitialized constant Router::Counters"
__proto__: $StandardError

raise @ kernel.rb:1070
const_missing @ module.rb:320
const_missing @ runtime.self-a59b728…6763d.js?body=1:211
Opal.const_get_relative @ runtime.self-a59b728…6763d.js?body=1:284
routes @ router.rb:5
initialize @ router.rb:8
Opal.send @ runtime.self-a59b728…763d.js?body=1:1605
new @ class.rb:44
TMP_6 @ injection.rb:0
Opal.yield1 @ runtime.self-a59b728…763d.js?body=1:1385
each @ hash.rb:422
Opal.send @ runtime.self-a59b728…763d.js?body=1:1605
init_injections @ injection.rb:21
mount_to @ component.rb:14
Opal.send @ runtime.self-a59b728…763d.js?body=1:1605
old_mount_to @ runtime.self-a59b728…763d.js?body=1:1780
mount_to @ (index):107
mount_to @ class_methods.rb:4
TMP_3 @ application.rb:0
load (async)

Opal.yieldX @ runtime.self-a59b728…763d.js?body=1:1411
call @ proc.rb:13
ready? @ browser.rb:19
Opal.send @ runtime.self-a59b728…763d.js?body=1:1605
Opal.modules.application @ application.rb:2
Opal.load @ runtime.self-a59b728…763d.js?body=1:2192
(anonymous) @ (index):218

Any ideas?

fazibear commented 4 years ago

Hi, thanks for trying Inesita :)

Looks like new application template is little bit broken.

You have to update Gemfile first (the version don't match!)

# inesita gems
gem 'inesita', '~> 0.9.0'
gem 'inesita-livereload', '~> 0.1.0'
gem 'inesita-router', '~> 0.3.0'

and run bundle update

There is also typo in Counters.

In app/components/navbar.rb replace all :counters with :counter (line 21 and 22)

In app/router.rb change Counters to Counter (line 7)

Now it should world, I'll fix this soon. Thanks for reporting.

fazibear commented 4 years ago

Please update Inesita to 0.9.1 and generate new application once again. It should work now.