heroku rake db:migrate > no such file to load — faker

后端 未结 3 1712
悲&欢浪女
悲&欢浪女 2020-12-30 04:09

I\'m trying to deploy a rails 3 app to heroku for the first time. It seems to push up ok but when I try to run

heroku rake db:migrate

I get

相关标签:
3条回答
  • 2020-12-30 04:47

    for me, Simone’s first approach didn’t work, but the second did: require 'faker' can be deleted from the rake file.

    0 讨论(0)
  • 2020-12-30 04:50

    Move the require statement into the task. For instance

    # sample_data.rake
    require 'faker'
    
    task :sample_data => :environment do
     # ...
    end
    

    to

    # sample_data.rake
    task :sample_data => :environment do
      require 'faker'
    
     # ...
    end
    

    In this way, the library will be required only when the task is invoked.

    The other alternative is to not require Faker in your rake file. In fact, it is already loaded by Bundler when the bundle is executed in development.

    If you don't want Bundler to load the Gem, use

    gem 'faker', '0.3.1', :require => false
    
    0 讨论(0)
  • 2020-12-30 04:50

    I too commented out require 'faker' in the lib/tasks/sample_data.rake file and (After committing this change via git) pushed the files to heroku, which allowed $heroku rake db:migrate --app <my app name> to successfully execute, and ergo the heorku site began working again.

    Thanks!

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