“rails generate” not working

前端 未结 2 1164
眼角桃花
眼角桃花 2020-12-23 01:59

When using ruby 2.1.0 (or 2.1.1) and I type rails g nothing happens. It simply hangs. But when I change to 1.9.3, using rvm use 1.9.3 it works as e

相关标签:
2条回答
  • 2020-12-23 02:15

    Have you tried to run:

    spring stop
    

    rails generate hangs may because spring is already running.

    see https://github.com/rails/spring/issues/265

    0 讨论(0)
  • 2020-12-23 02:37

    I tried all of this and it didn't work for me. Turns out that I had a bad rails file in my /bin folder.

    This is what I had:

    #!/usr/bin/env ruby
    begin
      load File.expand_path("../spring", __FILE__)
    rescue LoadError
    end
    require 'bundler/setup'
    load Gem.bin_path('rails', 'rails')
    

    And I just recreated a new rails app and copied the proper one:

    #!/usr/bin/env ruby
    begin
      load File.expand_path("../spring", __FILE__)
    rescue LoadError
    end
    APP_PATH = File.expand_path('../../config/application', __FILE__)
    require_relative '../config/boot'
    require 'rails/commands'
    

    This worked for me!

    0 讨论(0)
提交回复
热议问题