【问题标题】:Rails 4 + react-rails gem: Could not find generator 'react:install'Rails 4 + react-rails gem:找不到生成器'react:install'
【发布时间】:2015-11-09 00:31:18
【问题描述】:

我正在尝试关注 Fernando Villalobos 的 this Airpair tutorial,通过 react-rails gem 使用 Rails 和 React。

我创建了一个全新的 Rails 4 应用程序,现在我正在尝试安装 react-rails

这是我的 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

我已经同时运行了 bundle installbundle update(以防万一)。

但是,每当我尝试运行 rails g react:install as recommended here 时,我都会收到以下错误:

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.

知道这里出了什么问题吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 reactjs bundler react-rails


    【解决方案1】:

    尝试运行spring stop。您可能已附加到旧进程。

    【讨论】:

    • 在停止弹簧过程后为我工作。谢谢!!
    【解决方案2】:

    我遇到了同样的问题。我刚刚在一个新的 rails 项目中再次尝试了它——没有先运行 bundle install ——它成功了。

    【讨论】:

      猜你喜欢
      • 2014-07-21
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      • 2013-03-07
      • 1970-01-01
      • 2015-08-11
      • 2012-03-29
      • 1970-01-01
      相关资源
      最近更新 更多