简体   繁体   English

尝试启动Rails服务器时出现错误,提示它无法(carrier_wave)无法加载雾

[英]I'm getting an error when I try to start my rails server that it can't (carrier_wave) can't load fog

I don't know why but now when I try to start the rails server, either with rails s or bundle exec rails s I get this error: 我不知道为什么,但是现在当我尝试使用rails sbundle exec rails s启动rails服务器时,出现以下错误:

active_support/dependencies.rb:274:in 'require': cannot load such file -- fog (LoadError)

It was working and now it won't start. 它正在工作,现在将无法启动。

Were running carrier wave & fog and both gems are installed 正在运行载波和雾并且两个宝石都已安装

EDIT: 编辑:

Here is the Gemfile , sorry it's a link to a gist but SO decided that my post had too much code and so wouldn't let me submit, so for now, it's a gist. 这是Gemfile ,很抱歉,它是一个要点的链接,但是SO决定我的帖子中有太多代码,所以不让我提交,所以现在,这是要点。

EDIT: Here is the gist containing the config options for carrierwave, we have the config options in the environment files, so I just copied the code blocks into one file for the sake of this gist, I've obviously removed the private information, everything else is untouched. 编辑:这是包含载波配置选项的要点 ,我们在环境文件中有配置选项,因此出于这个要点,我只是将代码块复制到了一个文件中,显然我已经删除了私有信息,所有内容否则不受影响。

It seems that you're missing (at least) a line from your carrierwave.rb config file. 看来您(至少)在carrierwave.rb配置文件中缺少一行。 If you're using the fog-aws gem, you need to include the following line: 如果您使用的是fog-aws gem,则需要包含以下行:

config.fog_provider = 'fog/aws'

Check out the carrierwave readme , and you can see that the line is commented "required" in the official code sample, prior to setting up the credentials hash. 在设置凭证哈希之前,请查看载波自述文件 ,您会发现在官方代码示例中该行被注释为“必需”。

Edit: 编辑:

Just now found Carrierwave Issue 1648 which seems to support this solution. 刚刚发现了Carrierwave Issue 1648 ,它似乎支持此解决方案。

Edit 2: 编辑2:

I know you can either run Carrierwave with the fog-aws gem and the config I pointed out or with the fog gem without that line. 我知道您可以使用我所指出的fog-aws gem和配置运行Carrierwave,也可以使用不带该行的fog gem运行Carrierwave。 I'd suggest commenting out the config line and trying just the fog gem. 我建议注释掉配置行,然后尝试使用fog gem。

The next thing to try is to make sure you're using a version of Carrierwave that existed when your version of Rails was current. 接下来要尝试的是确保您使用的是当前版本的Rails时存在的Carrierwave版本。 Use bundle show carrierwave from your app's home dir to see the installed version and consider downgrading to 0.10.0 which would have been current when Rails 4.2.9 was current just to see what happens. 使用应用程序主目录中的bundle show carrierwave查看安装的版本,并考虑降级到0.10.0(这是当前Rails 4.2.9的最新版本),以查看会发生什么。 It could be that someone ran bundle update and broke the app, because while your gemfile specifies a Rails version, there's no specific version for Carrierwave. 可能是有人运行了bundle update并破坏了应用程序,因为尽管您的gemfile指定了Rails版本,但Carrierwave没有特定的版本。 Updating one without the other could be what broke your app. 没有一个更新另一个可能会破坏您的应用程序。

Normally I might not suggest file reversion because the Carrierwave readme explicitly states the current version works on Rails 4 or higher, but there has to be some explanation for why your app seemed fine before and is showing problems now. 通常,我可能不建议文件还原,因为Carrierwave自述文件明确指出当前版本可在Rails 4或更高版本上运行,但是必须对为什么您的应用以前看起来还不错并且现在出现问题进行一些解释。 It's probably worthwhile to speculate a little at this point. 在这一点上推测一下可能是值得的。

Just on whim, I added the fog gem to the Gemfile and...the problem went away, I mean, there is still a problem but it's unrelated to this one. 只是一时兴起,我将fog宝石添加到了Gemfile中,...问题消失了,我的意思是,仍然有问题,但这与该问题无关。 I thought you didn't need to use fog if your using fog-aws , plus why was it working before and not now? 我以为如果使用fog-aws就不需要用fog ,再加上为什么以前而不是现在能工作?

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

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