简体   繁体   English

Rails 4 + react-rails gem:找不到生成器'react:install'

[英]Rails 4 + react-rails gem: Could not find generator 'react:install'

I am trying to follow this Airpair tutorial by Fernando Villalobos, to play around with Rails and React through the react-rails gem. 我正在尝试遵循Fernando Villalobos的Airpair教程 ,通过react-rails gem来玩Rails和React。

I created a brand new Rails 4 app and I am now trying to install react-rails . 我创建了一个全新的Rails 4应用程序,我现在正在尝试安装react-rails

This is my Gemfile: 这是我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.2'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'bootstrap-sass'
gem 'react-rails', '~> 1.4.0'

# 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
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

I already ran both bundle install and bundle update (just in case). 我已经运行了bundle installbundle update (以防万一)。

But, whenever I try to run rails g react:install as recommended here , I keep getting the following error: 但是,每当我尝试运行rails g react:install 按照此处的建议 rails g react:install ,我不断收到以下错误:

Could not find generator 'react:install'. Maybe you meant 'test_unit:job' or 'test_unit:model' or 'generator'
Run `rails generate --help` for more options.

Any idea of what's wrong here? 知道这里有什么问题吗?

Try running spring stop . 尝试运行spring stop You might have attached to an old process. 您可能已附加到旧流程。

I had the same problem. 我有同样的问题。 I just tried it again in a new rails project - without running bundle install first - and it worked. 我刚刚在一个新的rails项目中尝试了它 - 没有先运行bundle install - 它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM