0
votes

I am new to Rails and programming in general. I built an app by following a tutorial on YouTube. I got the whole thing done, then started fiddling with Ruby and Rails versions. Maybe a mistake.... Anyway, I can no longer get the Rails S command to work. Pasted below is the error I am getting. I welcome any suggestions you might have.

tom@linux:~/apps/BookReview$ rails s => Booting Puma => Rails 5.2.0 application starting in development => Run rails server -h for more startup options Exiting /home/tom/apps/BookReview/config/environments/development.rb:3:in block in <top (required)>': uninitialized constant Paperclip (NameError) from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/railtie.rb:216:ininstance_eval' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/railtie.rb:216:in configure' from /home/tom/apps/BookReview/config/environments/development.rb:1:in' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/engine.rb:602:in block (2 levels) in <class:Engine>' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/engine.rb:601:ineach' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/engine.rb:601:in block in <class:Engine>' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:ininstance_exec' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in run' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:inblock in run_initializers' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:228:in block in tsort_each' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:422:in block (2 levels) in each_strongly_connected_component_from' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:431:ineach_strongly_connected_component_from' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:421:in block in each_strongly_connected_component_from' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:ineach' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:in tsort_each_child' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:415:incall' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:415:in each_strongly_connected_component_from' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:349:inblock in each_strongly_connected_component' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in each' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:incall' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in each_strongly_connected_component' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:226:intsort_each' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:205:in tsort_each' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:inrun_initializers' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/application.rb:361:in initialize!' from /home/tom/apps/BookReview/config/environment.rb:5:in' from config.ru:3:in require_relative' from config.ru:3:inblock in ' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in instance_eval' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/builder.rb:55:ininitialize' from config.ru:in new' from config.ru:in' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in eval' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/builder.rb:49:innew_from_string' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/builder.rb:40:in parse_file' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/server.rb:319:inbuild_app_and_options_from_config' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/server.rb:219:in app' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:inapp' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.5/lib/rack/server.rb:354:in wrapped_app' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:89:inlog_to_stdout' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:51:in start' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:inblock in perform' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in tap' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:inperform' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:ininvoke_command' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:inperform' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/command.rb:46:in invoke' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in' from /home/tom/apps/BookReview/bin/rails:9:in require' from /home/tom/apps/BookReview/bin/rails:9:in' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in load' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:incall' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:inrun' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in <top (required)>' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:inload' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in <top (required)>' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:inrequire' from /home/tom/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in require' from /home/tom/apps/BookReview/bin/spring:15:in' from bin/rails:3:in load' from bin/rails:3:in'

1
Did you bundle install after adding Paperclip to your Gemfile?Brian Kung
Also recommend looking into ActiveStorage instead of Paperclip if you are on Rails 5.2+, as Paperclip is deprecated: robots.thoughtbot.com/closing-the-tromboneBrian Kung
I somehow lost Paperclip along the way. That was the problem. I will look into ActiveStorage for sure. Thanks for that tip.Tom Johnston

1 Answers

0
votes

Include the paperclip gem in your Gemfile, if it's not already added.

gem "paperclip", git: "git://github.com/thoughtbot/paperclip.git"

After that run bundle install