-
Notifications
You must be signed in to change notification settings - Fork 753
Description
Hello, I'm struggling with a basic react-rails install in a simple/vanilla app.
Short version:
After an attempted install, Loading any page results in the error:
"couldn't find file 'react'
(in .../app/assets/javascripts/application.js:16)
coming from the second line of the extracted source below (from app/views/layouts/application.html.erb)
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
Also, if I try modifying config/environments/development.rb by adding
config.react.variant = :development
then as soon as I start the rails server I get an error (personal paths changed to ... below)
$ bin/rails s -b 0.0.0.0
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
.../.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `react' for #<Rails::Application::Configuration:0x00000001a79d50> (NoMethodError)
from .../config/environments/development.rb:42:in `block in <top (required)>'
from .../.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/railtie.rb:210:in `instance_eval'
from .../.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/railtie.rb:210:in `configure'
from .../config/environments/development.rb:1:in `<top (required)>'
from .../.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
...
I have hit this with both 1.0.0.pre and 0.12.0, with no noticeable change. Here are the instructions I believe I've followed: https://github.com/reactjs/react-rails/blob/master/README.md
Here's some info about what I'm running:
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rails -v
Rails 4.2.0
This line is at the bottom of my Gemfile:
gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails'
And I ran "bundle install", and here's the relevant parts of the output:
Using react-source 0.12.2
Using react-rails 1.0.0.pre from git://github.com/reactjs/react-rails.git (at master)
I also ran
rails g react:install
Here's the relevant portion of app/assets/javascripts/application.js
...
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require react
//= require react_ujs
//= require components
//= require_tree .
The sample app works fine if I leave out the newly added "require" lines from application.js (or comment out javascript_include_tag line from app/views/layouts/application.html.erb).
Any suggestions would be very welcome; as I mentioned, I also tried 0.12 (based on the instructions here, and got the exact same results: https://github.com/reactjs/react-rails/blob/0.12/README.md )
Thanks!