Rails 4 +反应堆- Rails gem:找不到生成器'react:install'

时间:2021-08-27 00:19:51

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教程,使用Rails并通过反应炉- Rails gem做出反应。

I created a brand new Rails 4 app and I am now trying to install react-rails.

我创建了一个全新的Rails 4应用程序,现在正在尝试安装堆- 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).

我已经运行了捆绑安装和捆绑更新(以防万一)。

But, whenever I try to run rails g react:install as recommended here, I keep getting the following error:

但是,每当我尝试运行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?

有什么问题吗?

2 个解决方案

#1


1  

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——它就成功了。

#2


1  

Try running spring stop. You might have attached to an old process.

尝试运行spring停止。您可能已经附加到一个旧的进程。

#1


1  

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——它就成功了。

#2


1  

Try running spring stop. You might have attached to an old process.

尝试运行spring停止。您可能已经附加到一个旧的进程。