Ruby-on-rails – bundler update fails with thesterious permission denied

bundlerruby-on-railsrubygems

I can't tell why bundler is looking for actionpack-1.4.0.gem, but it is causing my bundle update command to die.

Here are all the relevant transcripts (to the best of my knowledge…)

$ bundle update
Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using Ascii85 (1.0.0) 
/opt/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:145:in `initialize': Permission denied - /opt/local/lib/ruby/gems/1.8/cache/actionpack-1.4.0.gem (Errno::EACCES)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:145:in `open'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:145:in `download'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:255:in `download_gem_from_uri'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:72:in `fetch'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:45:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:275:in `update'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.10/bin/bundle:13
from /opt/local/bin/bundle:19:in `load'
from /opt/local/bin/bundle:19

OK, so it's failing due to a permission denied on this path, but there's no file there:

/mydev/ElectionManager(export-work)> ls /opt/local/lib/ruby/gems/1.8/cache/actionpack-1.4.0.gem
ls: /opt/local/lib/ruby/gems/1.8/cache/actionpack-1.4.0.gem: No such file or directory

Ok, let's look at the environment. Is there something fishy there?

/mydev/ElectionManager(export-work)> env
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/opt/local/lib/ruby/gems/1.8
TERM=xterm-color
SHELL=/bin/bash
TMPDIR=/var/folders/BF/BFIqAzICGVuMEvQQwzRkvE+++TI/-Tmp-/
Apple_PubSub_Socket_Render=/tmp/launch-9H2vLV/Render
TERM_PROGRAM_VERSION=273.1
USER=pitosalas
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-4WmMHp/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
 PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin/
PWD=/mydev/ElectionManager
EDITOR=mate -w
LANG=en_US.UTF-8
PS1=\w$(__git_ps1 "(%s)")> 
SHLVL=1
HOME=/Users/pitosalas
LOGNAME=pitosalas
DISPLAY=/tmp/launch-p24Csr/org.x:0
OLDPWD=/Users/pitosalas
_=/usr/bin/env

Nothing fishy. Let's look through all the code to see if actionpack-1 is ever even mentioned:

/mydev/ElectionManager(export-work)> grep  -r -i "actionpack-1" .
/mydev/ElectionManager(export-work)> 

Nope it's not mentioned. And what is in Gemfile?

$ cat Gemfile 


source :gemcutter

#gem 'rails', "2.3.8"
gem 'rails'
gem "sqlite3-ruby", "1.2.5", :require => "sqlite3"

gem "authlogic"
gem "prawn", '>= 0.7.2'
gem 'will_paginate', '~> 2.3.11'
gem 'tpitale-constant_cache', '>= 0.1.2', :require => 'constant_cache'
 gem 'rubyzip', '>= 0.9.4', :require => 'zip/zip'
 gem 'redgreen', '>=1.2.2'
 gem 'searchlogic', '>=2.4.14'
 gem 'cancan'
 gem 'fastercsv'

 group :development do
 end

 group :test do
   gem 'thoughtbot-shoulda', '>=2.10.2',  :require => 'shoulda'
   gem 'machinist'
   gem 'faker'
   gem 'mocha'
   gem 'pdf-reader'
   gem 'awesome_print'
   gem 'turn'
   gem 'rspec'
 end

 group 'cucumber' do
   gem 'machinist'
   gem 'faker'
   gem 'cucumber-rails',  '>=0.3.0',  :require => false
   gem 'database_cleaner',  '>=0.5.0', :require => false
 gem 'webrat',  '>=0.7.0', :require => false
 gem 'pickle', :require => false
end

group :production do

end

Ok that looks pretty good. What does gem think it knows about rails gems?

/mydev/ElectionManager(export-work)> gem list rails

* LOCAL GEMS *

rails (3.0.4, 2.3.8, 2.3.5, 2.3.4, 2.2.2)
rails_best_practices (0.6.4, 0.3.26, 0.3.19, 0.3.16)
/mydev/ElectionManager(export-work)> 

Best Answer

ActionPack is a dependency of rails. What happens when you run a bundle install? That should install the relevant actionpack version.

However, It does seem like it's looking for an old version of actionpack though.

Search for actionpack in your Gemfile.lock. That will tell you what it's a dependency of.

Also if bundler is trying to install to system gems, you may need to sudo bundle install although you're better off giving it a path to install to:

bundle install --path=/something/specific/to/this/project

Related Topic