简体   繁体   English

LoadError:无法加载此类文件-ffaker

[英]LoadError: cannot load such file — ffaker

Please forgive my ignorance. 请原谅我的无知。 I'm having issues raking my database on heroku. 我在heroku上耙数据库时遇到问题。 When I run : 当我跑步时:

heroku run rake db:migrate

I get 我懂了

rake aborted!
LoadError: cannot load such file -- ffaker
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `require'
/app/lib/tasks/seed.rake:1:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `block in load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `bl
ock in run_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `ea
ch'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `ru
n_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/application.rb:384:i
n `run_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:449:in `lo
ad_tasks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/railtie.rb:194:in `p
ublic_send'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/railtie.rb:194:in `m
ethod_missing'
/app/Rakefile:6:in `<top (required)>'
(See full trace by running task with --trace)

I've tried following the solutions from heroku rake db:migrate > no such file to load -- faker with no luck. 我尝试遵循heroku rake db:migrate的解决方案>没有要加载的文件-造假者没有运气。 I really am not sure where else to go from here. 我真的不确定从这里还能去哪里。 I would greatly appreciate any help. 我将不胜感激任何帮助。 Thanks. 谢谢。

您应该在代码中指定此代码:

require 'ffaker'

Also, make sure you have ffaker in the right gem group. 另外,请确保您在正确的gem组中有更偏爱的人。 I was setting up a staging environment and wanted to load dummy data and forgot ffaker was only in development and testing environment groups. 我当时正在建立一个暂存环境,并希望加载虚拟数据,而忘了ffaker只在开发和测试环境组中。

I was using the git URL to add ffaker in my Gemfile. 我用的是git的URL添加ffaker在我的Gemfile。 I removed this URL, run bundle again and everything works ok now. 我删除了该URL,再次运行bundle,一切正常。

-  gem 'ffaker', '~>2.10.0', git: 'https://github.com/ffaker/ffaker.git'
+  gem 'ffaker', '~>2.10.0'

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

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