Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails no such file to load -- ap (LoadError)

When I try any of the rails, rake command in staging server I got no such file to load -- ap (LoadError),

for rails s:

/usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in`require': no such file to load -- ap (LoadError)    
 xxxx    
/config/application.rb:7

for rake -T:

rake aborted!
no such file to load -- ap

my application.rb file:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production. 

Bundler.require(:default, Rails.env) if defined?(Bundler)

my rails and ruby version:

  • rails version in local and staging: 3.0.11
  • ruby version in staging: ruby 1.8.7 (2012-02-08 patchlevel 358)
  • ruby version in local:ruby 1.8.7 (2011-06-30 patchlevel 352)

But I can run rails s, rails c, rake log:clear everything in my local machine. Gemfile file in staging is same as Gemfile in local.

what am I missing here? how can I resolve this?

like image 845
Arivarasan L Avatar asked Mar 24 '14 11:03

Arivarasan L


1 Answers

In your Gemfile, change this line:

gem "awesome_print", :require => "ap" 

...to this:

gem "awesome_print"

I just had the same thing happen to me. ap is a custom defined alias for awesome_print. This allows you to do things like ap Product.first and it will pretty print it for you. Much easier than typing out awesome_print Product.first

I'm not sure why, but when this happened to me, I dropped the alias, and it loaded without an issue. There is probably something else in play here that someone smarter than myself can explain, but I know that this worked for me.

like image 153
Adam Kalnas Avatar answered Sep 28 '22 16:09

Adam Kalnas