rails-composer icon indicating copy to clipboard operation
rails-composer copied to clipboard

Permission denied - /.bundle (Errno::EACCES) when executing rails-composer using the conventional approach

Open trein opened this issue 11 years ago • 25 comments

Hi.

I tried to create a new application using rails-composer, but I keep receiving a permission denied error.

$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

However, if I follow the second method by creating an empty application root directory (commands below), it does not happen.

$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.0.0@myapp --ruby-version --create
$ gem install rails
$ rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

Reference: http://railsapps.github.io/installrubyonrails-mac.html

The error is the following:

composer  Installing gems. This will take a while.
    run    bundle install --without production from "."
/Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/shell/basic.rb:336: warning: Insecure world writable dir
/Users/trein/.rvm/gems/ruby-2.0.0-p247/bin in PATH, mode 040777
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /.bundle (Errno::EACCES)
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from /Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/settings.rb:127:in `set_key'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/settings.rb:17:in `[]='
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/settings.rb:79:in `without='
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:237:in `install'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `load'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `<main>'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/trein/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'"""

trein avatar Oct 26 '13 01:10 trein

What are the Unix permissions for each directory?

DanielKehoe avatar Oct 26 '13 03:10 DanielKehoe

Did you ever solve this problem? I'm having the same issue

00hello avatar Oct 29 '13 13:10 00hello

I have got the same problem.

I am working as user: axel Permissions from my source folder, were i want to create the new railsapp drwxr-xr-x 6 axel axel 4096 Okt 31 20:41 . drwxr-xr-x 36 axel axel 4096 Okt 31 20:24 ..

ruby is installed with rvm and it is under my user folder ( /home/axel/.rvm/....)

rails new myapp works perfect, i also can add something to the gemfile and make an bundle install.

Only with the composer it fails. Error is the same like above. run bundle install --without production from "." Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks! /home/axel/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /.bundle (Errno::EACCES)

AxelWal avatar Oct 31 '13 19:10 AxelWal

Sorry for the late response. I'm owner of all directories. I don't believe it is a permissions related problem since the other approach worked correctly.

Looking at the composer.rb code, I think it can be something related to (line 2718):

say_wizard "Installing gems. This will take a while."
if prefs.has_key? :bundle_path
  run "bundle install --without production --path #{prefs[:bundle_path]}"
else
  run 'bundle install --without production'
end
say_wizard "Updating gem paths."
Gem.clear_paths

@davidynamic and @AxelWalsleben: If you guys are stuck in this problem, you can use the second possible method creating an empty application root directory and then calling rails with composer:

$ mkdir myapp
$ cd myapp
$ rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

Cheers, --trein

trein avatar Oct 31 '13 20:10 trein

@trein: The Second Method works also not.

AxelWal avatar Nov 01 '13 09:11 AxelWal

i patched the source, that the --path at bundle install is set, but that creates the same error.

AxelWal avatar Nov 01 '13 11:11 AxelWal

I've released a new version that eliminates the 'bundle_path' hidden preference. Let me know if the issue is resolved, please.

DanielKehoe avatar Nov 03 '13 02:11 DanielKehoe

@DanielKehoe I tried again today after your, but same problem. So, for some reason .bundle is being created at / and not at the app folder. Do you have any idea why?

run    bundle install --without production from "."
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/trein/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /.bundle (Errno::EACCES)

trein avatar Nov 04 '13 17:11 trein

I had the same problem. I still don't know the reason but everything started working after running gem update

IvanMisyats avatar Nov 05 '13 23:11 IvanMisyats

@IvanMisyats is right. Just tested here and it worked. Thanks very much. If this solution works for the other people that were having trouble with that, we can close this issue as invalid. What do you guys think?

trein avatar Nov 06 '13 02:11 trein

What version of RubyGems were you using before the gem update?

gem -v

DanielKehoe avatar Nov 06 '13 02:11 DanielKehoe

Sorry about that, but I did not check it before running gem update. Now it is 2.1.10.

trein avatar Nov 06 '13 02:11 trein

After gem update, it also works in my case.

AxelWal avatar Nov 06 '13 09:11 AxelWal

I'll close this issue now. Please reopen if anyone is still encountering it.

DanielKehoe avatar Nov 15 '13 01:11 DanielKehoe

Does this have to do with setting the linux home directory in ~/.profile?

fixed with this url given from ruby --debug http://stackoverflow.com/questions/9056008/installed-ruby-1-9-3-with-rvm-but-command-line-doesnt-show-ruby-v/9056395#9056395

ghost avatar Dec 05 '13 19:12 ghost

I had this issue and similar when moving to a new server.

I had installed rvm, ruby and rails as root.

I uninstalled them and reinstalled them as my self and the errors disappeared.

MichaelSvendsen avatar Feb 12 '14 10:02 MichaelSvendsen

[SOLVED] just remove .bundle directory in your application path

itsNikolay avatar Dec 17 '14 09:12 itsNikolay

please reopen, this is not solved

to reproduce & verify, please run this Dockerfile docker build -t openproject:4.0 . https://github.com/blaggacao/openproject-docker/blob/734578741e072769a83c17235c6ed9d9c22da87f/Dockerfile

here is the gem update

blaggacao avatar Jan 02 '15 11:01 blaggacao

whats that mean.? Errno::EACCES: Permission denied - /Users/spaceodyssey/Desktop/hipster/vendor/bundle/ruby/2.0.0/gems/hitimes-1.2.2/.travis.yml An error occurred while installing hitimes (1.2.2), and Bundler cannot continue. Make sure that gem install hitimes -v '1.2.2' succeeds before bundling. ?

SpaceG avatar Jan 15 '15 10:01 SpaceG

@SpaceG you could try this

chown your_username /Users/spaceodyssey/Desktop/hipster -R

itsNikolay avatar Jan 15 '15 12:01 itsNikolay

Woah that worked for me, thanks @itsNikolay

FYI the error message I was getting was from of a Snow Plow installation on an EC2 instance with Amazon Linux (https://github.com/snowplow/snowplow/wiki/1-Installing-EmrEtlRunner)

The message was:

Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/ec2-user/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /bin/snowplow/3-enrich/emr-etl-runner/.bundle (Errno::EACCES)

The command I ran to fix was :

sudo chown ec2-user /bin/snowplow/3-enrich/emr-etl-runner -R

eoglethorpe avatar Jan 17 '15 02:01 eoglethorpe

Hmm... I thought this is about fixing, and not for providing support... my2cents

blaggacao avatar Jan 17 '15 21:01 blaggacao

I'm leaving this issue open because it seems some developers are encountering this issue. As far as I can tell, it is a local configuration issue and there's nothing to fix in Rails Composer. As long as people are encountering the issue, it's helpful that people are offering ideas for resolution, and hopefully it will mean everyone will have success using Rails Composer.

DanielKehoe avatar Jan 18 '15 07:01 DanielKehoe

I'm unsure of the real cause of this issue but running as sudo works as the offending libraries are installed with root.

kevdowney avatar Mar 26 '15 18:03 kevdowney

I faced the same problem. I'n my case i needed to run my comman from directory i've permited do "mkdir" command.

AndyFrontera avatar Feb 11 '16 11:02 AndyFrontera