0

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.

Thermatix
  • 2,757
  • 21
  • 51

2 Answers2

0

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.

MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
  • I won't be able to check this till tommrow but I will state that I wasn't the one to create the config, the strange thing is that it was working until recently. – Thermatix Aug 14 '17 at 19:25
  • Could it be that someone changed the gemfile? I think that if you use fog rather than fog-aws, you can skip that config line because the default behavior is to use fog. Could also be that you may not have been aware of something that someone else changed. Either way, I'm sure you'll feel better with a resolution. – MarsAtomic Aug 14 '17 at 19:29
  • ok, I added the config option and still erring exactly the same, `cannot load such file -- fog ` – Thermatix Aug 15 '17 at 07:18
  • @Thermatix: Updated with more possibilities. – MarsAtomic Aug 15 '17 at 11:44
  • see the comment to my answer – Thermatix Aug 15 '17 at 12:42
0

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?

Thermatix
  • 2,757
  • 21
  • 51
  • In the end, I just discarded all changes in the current branch and the problem went away, I believe the problem is that a `bundle update` changed versions and broke things, as the `Gemfile` doesn't have version constraints for all gems (ugh), any way, the problem is solved (sorta) so yay, also thanks for all the help. – Thermatix Aug 15 '17 at 12:42