简体   繁体   中英

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:

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.

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. If you're using the fog-aws gem, you need to include the following line:

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.

Edit 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. I'd suggest commenting out the config line and trying just the 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. 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. 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. 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. 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. I thought you didn't need to use fog if your using fog-aws , plus why was it working before and not now?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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