React-rails: Unable to run rails g react:install

Created on 9 Feb 2015  ·  22Comments  ·  Source: reactjs/react-rails

I'm getting the following output when I try to run rails g react:install.

git://github.com/reactjs/react-rails.git (at master) is not yet checked out. Run `bundle install` first.

I had a different issue (I believe related to the coffee-script-source being 1.9.0 but react-rails requiring 1.9.0). I ran bundle update to resolve this, but now I'm running into this error.

Most helpful comment

rails/spring#383
I have same issue.
Workaround: run with DISABLE_SPRING environment variable, e.g.:

DISABLE_SPRING=true rails g react:install

All 22 comments

It looks like you need to first run bundle install to get react-rails
installed.

On Mon, Feb 9, 2015 at 1:44 PM, Mohamad El-Husseini <
[email protected]> wrote:

I'm getting the following output when I try to run rails g react:install.

git://github.com/reactjs/react-rails.git (at master) is not yet checked out. Run bundle install first.

I had a different issue (I believe related to the coffee-script-source
being 1.9.0 but react-rails requiring 1.9.0). I ran bundle update to
resolve this, but now I'm running into this error.


Reply to this email directly or view it on GitHub
https://github.com/reactjs/react-rails/issues/169.

@jjulian sorry, I didn't state that I ran bundle install because it seemed obvious, but I did run it, and it completes normally.

Do you get the same error when you run bundle exec rails g react:install?

If you do get the same error, are you willing to post your Gemfile and
Gemfile.lock?

On Mon, Feb 9, 2015 at 2:16 PM, Mohamad El-Husseini <
[email protected]> wrote:

@jjulian https://github.com/jjulian sorry, I didn't state that I ran bundle
install because it seemed obvious, but I did run it, and it completes
normally.


Reply to this email directly or view it on GitHub
https://github.com/reactjs/react-rails/issues/169#issuecomment-73570769.

Yes, same result, unfortunately. I have this in my gem file:

gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails'

I thought I'd try updating to master, I got this error:

rmosolgo ~/code/check-ins $ bundle update react-rails
Updating git://github.com/reactjs/react-rails.git
Fetching source index from https://gems.contribsys.com/
Fetching gem metadata from https://rubygems.org/......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "coffee-script-source":
  In snapshot (Gemfile.lock):
    coffee-script-source (1.9.0)

  In Gemfile:
    react-rails (~> 1.0.0.pre) ruby depends on
      coffee-script-source (= 1.8.0) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

I guess it's for downgrading coffee-script-source in master. It was causing test failures.

I edited Gemfile.lock and manually switched 1.9.0 to 1.8.0.

Then I had success:

rmosolgo ~/code/check-ins $ bundle update react-rails
Updating git://github.com/reactjs/react-rails.git
Fetching source index from https://gems.contribsys.com/
Fetching gem metadata from https://rubygems.org/......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
# ... gems 
Your bundle is updated!

Does that work in your case?

@xionon @rmosolgo I'm afraid not. I'm already using 1.8.0 in my Gemlock. Here they are:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

#
# Add custom gems below this line
#

gem 'bootstrap-sass', '~> 3.3.1'
gem 'autoprefixer-rails'

group :development do
  gem 'quiet_assets'
  gem 'guard'
  gem 'guard-minitest'
end

group :test do
  gem 'shoulda'
end

gem 'rack-mini-profiler'

gem 'devise'
gem 'devise-i18n'

gem 'rails-i18n'

gem 'will_paginate'
gem 'will_paginate-bootstrap'

gem 'gravatar_image_tag'
gem 'font-awesome-rails'
gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails'
  remote: git://github.com/reactjs/react-rails.git
  revision: 80f67226691280495a9d6f95901c8c0de00ed563
  specs:
    react-rails (1.0.0.pre)
      coffee-script-source (= 1.8.0)
      connection_pool
      execjs
      rails (>= 3.1)
      react-source (~> 0.12)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.0)
      actionpack (= 4.2.0)
      actionview (= 4.2.0)
      activejob (= 4.2.0)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.0)
      actionview (= 4.2.0)
      activesupport (= 4.2.0)
      rack (~> 1.6.0)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    actionview (4.2.0)
      activesupport (= 4.2.0)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    activejob (4.2.0)
      activesupport (= 4.2.0)
      globalid (>= 0.3.0)
    activemodel (4.2.0)
      activesupport (= 4.2.0)
      builder (~> 3.1)
    activerecord (4.2.0)
      activemodel (= 4.2.0)
      activesupport (= 4.2.0)
      arel (~> 6.0)
    activesupport (4.2.0)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.0)
    autoprefixer-rails (5.1.5)
      execjs
      json
    bcrypt (3.1.10)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.3.3)
      autoprefixer-rails (>= 5.0.0.1)
      sass (>= 3.2.19)
    builder (3.2.2)
    byebug (3.5.1)
      columnize (~> 0.8)
      debugger-linecache (~> 1.2)
      slop (~> 3.6)
    celluloid (0.16.0)
      timers (~> 4.0.0)
    coderay (1.1.0)
    coffee-rails (4.1.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.8.0)
    columnize (0.9.0)
    connection_pool (2.1.1)
    debug_inspector (0.0.2)
    debugger-linecache (1.2.0)
    devise (3.4.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise-i18n (0.11.3)
    erubis (2.7.0)
    execjs (2.3.0)
    ffi (1.9.6)
    font-awesome-rails (4.3.0.0)
      railties (>= 3.2, < 5.0)
    formatador (0.2.5)
    globalid (0.3.2)
      activesupport (>= 4.1.0)
    gravatar_image_tag (1.2.0)
    guard (2.12.1)
      formatador (>= 0.2.4)
      listen (~> 2.7)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-minitest (2.4.3)
      guard-compat (~> 1.2)
      minitest (>= 3.0)
    hike (1.2.3)
    hitimes (1.2.2)
    i18n (0.7.0)
    jbuilder (2.2.6)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (4.0.3)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.2)
    listen (2.8.5)
      celluloid (>= 0.15.2)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    loofah (2.0.1)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    method_source (0.8.2)
    mime-types (2.4.3)
    mini_portile (0.6.2)
    minitest (5.5.1)
    multi_json (1.10.1)
    nenv (0.2.0)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    notiffany (0.0.4)
      nenv (~> 0.1)
      shellany (~> 0.0)
    orm_adapter (0.5.0)
    pg (0.18.1)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    quiet_assets (1.1.0)
      railties (>= 3.1, < 5.0)
    rack (1.6.0)
    rack-mini-profiler (0.9.2)
      rack (>= 1.1.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.0)
      actionmailer (= 4.2.0)
      actionpack (= 4.2.0)
      actionview (= 4.2.0)
      activejob (= 4.2.0)
      activemodel (= 4.2.0)
      activerecord (= 4.2.0)
      activesupport (= 4.2.0)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.0)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.5)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.1)
      loofah (~> 2.0)
    rails-i18n (4.0.3)
      i18n (~> 0.6)
      railties (~> 4.0)
    railties (4.2.0)
      actionpack (= 4.2.0)
      activesupport (= 4.2.0)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    rb-fsevent (0.9.4)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rdoc (4.2.0)
    react-source (0.12.2)
    responders (2.1.0)
      railties (>= 4.2.0, < 5)
    sass (3.4.11)
    sass-rails (5.0.1)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (~> 1.1)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    shellany (0.0.1)
    shoulda (3.5.0)
      shoulda-context (~> 1.0, >= 1.0.1)
      shoulda-matchers (>= 1.4.1, < 3.0)
    shoulda-context (1.2.1)
    shoulda-matchers (2.8.0)
      activesupport (>= 3.0.0)
    slop (3.6.0)
    spring (1.3.0)
    sprockets (2.12.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.2.4)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    timers (4.0.1)
      hitimes
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.3)
      rack (>= 1.0)
    web-console (2.0.0)
      activemodel (~> 4.0)
      binding_of_caller (>= 0.7.2)
      railties (~> 4.0)
      sprockets-rails (>= 2.0, < 4.0)
    will_paginate (3.0.7)
    will_paginate-bootstrap (1.0.1)
      will_paginate (>= 3.0.3)

PLATFORMS
  ruby

DEPENDENCIES
  autoprefixer-rails
  bootstrap-sass (~> 3.3.1)
  byebug
  coffee-rails (~> 4.1.0)
  devise
  devise-i18n
  font-awesome-rails
  gravatar_image_tag
  guard
  guard-minitest
  jbuilder (~> 2.0)
  jquery-rails
  pg
  quiet_assets
  rack-mini-profiler
  rails (= 4.2.0)
  rails-i18n
  react-rails (~> 1.0.0.pre)!
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  shoulda
  spring
  turbolinks
  uglifier (>= 1.3.0)
  web-console (~> 2.0)
  will_paginate
  will_paginate-bootstrap

@rmosolgo I just removed a bunch of gems and tried again, and the generator still gives me the same error message. Not really sure what's going on. I removed react-source, updated, downgraded coffee-script-source manually to 1.8.0, successfully ran bundle install. But the generator is still busted.

Sorry for spouting off, but I guess the generator is not a big deal. I can create the stuff manually. But it's something to look into.

i'm with ya, that's such a drag :S I'm pretty sure requiring the smaller coffee-script-source version was the right move, but it stinks that it had some unexpected (and untested) side effects :(

@abitdodgy Hi, I spent some time looking into this. I think the issue is with spring. I have no idea if that's our fault, or spring's; I'm not very familiar with spring, and have always generated apps using --skip-spring, and thus haven't noticed this issue before.

I created two brand-new rails 4.2 apps, one with spring, and one without. Only the one with spring showed this behavior.

rails new react-with-spring
rails new react-without-spring --skip-spring
cd react-with-spring
echo "gem 'coffee-script-source', '1.8.0'\ngem 'react-rails', github: 'reactjs/react-rails', branch: 'master'" >> Gemfile
rm Gemfile.lock
bundle install
rails g
# error message
cd ../react-without-spring
echo "gem 'coffee-script-source', '1.8.0'\ngem 'react-rails', github: 'reactjs/react-rails', branch: 'master'" >> Gemfile
rm Gemfile.lock
bundle install
rails g
# no problem here

Can you try removing spring (both the gem and the binstubs) and see if that solves your problem?

Instructions for removing spring can be found here.

I can confirm that removing spring via these instructions made my empty rails app work again.

@xionon thanks for looking into this. In fact, it's not just the react generator. It seems like all the generators break with the same message, simply by including the rails-react gem.

rails/spring#383
I have same issue.
Workaround: run with DISABLE_SPRING environment variable, e.g.:

DISABLE_SPRING=true rails g react:install

@abitdodgy I think this dependency is creeping in through the use of coffee-rails 4.1.0 I had the same issue

Bundler could not find compatible versions for gem "coffee-script-source":
  In snapshot (Gemfile.lock):
    coffee-script-source (1.9.0)

  In Gemfile:
    react-rails (~> 1.0.0.pre) ruby depends on
      coffee-script-source (= 1.8.0) ruby

But when I relaxed coffee-rails back to 4.0.1 all was well.

I can't even bundle with gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails'
same error as 1 comment above.

Yuck, sorry! They've just released coffee-script-source 1.9.1 which seems to work with react-rails. Try to install again?

@rmosolgo works fine now. Thanks!

Just updated after 1.9.1, and this works without any issues

➜  iphq git:(master) ✗ rails g react:install
       exist  app/assets/javascripts/components
   identical  app/assets/javascripts/components/.gitkeep
      insert  app/assets/javascripts/application.js
      insert  app/assets/javascripts/application.js
      insert  app/assets/javascripts/application.js
   identical  app/assets/javascripts/components.js

@abitdodgy does the fix work for you?

Hi guys, @rmosolgo @vipulnsward I'm afraid not.

bundle exec gem list coffee-script-source
*** LOCAL GEMS ***
coffee-script-source (1.9.1)

Both normal and with bundle exec.

bundle exec rails g react:install
git://github.com/reactjs/react-rails.git (at master) is not yet checked out. Run `bundle install` first.

I even downgraded coffee-script-source 1.8.0 and I still get the same error. Can anyone share what version of spring they are using?

Solved! It turns out it's a Spring issue. Checkout the change log with releases 1.3.2 and 1.3.3 that purportedly fixed the issue. I upgraded Spring to 1.3.3 and it's fixed now.

@kanfet Thanks! Your solution also worked for me.

I had to run spring stop. That worked for me 👍

Was this page helpful?
0 / 5 - 0 ratings