Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
trein opened this issue Oct 26, 2013 · 25 comments

Comments

@trein
Copy link

trein commented Oct 26, 2013

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>'"""
@DanielKehoe
Copy link
Member

What are the Unix permissions for each directory?

@00hello
Copy link

00hello commented Oct 29, 2013

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

@AxelWal
Copy link

AxelWal commented Oct 31, 2013

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)

@trein
Copy link
Author

trein commented Oct 31, 2013

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

DanielKehoe referenced this issue in RailsApps/rails_apps_composer Nov 1, 2013
@AxelWal
Copy link

AxelWal commented Nov 1, 2013

@trein: The Second Method works also not.

@AxelWal
Copy link

AxelWal commented Nov 1, 2013

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

@DanielKehoe
Copy link
Member

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

@trein
Copy link
Author

trein commented Nov 4, 2013

@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)

@IvanMisyats
Copy link

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

@trein
Copy link
Author

trein commented Nov 6, 2013

@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?

@DanielKehoe
Copy link
Member

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

gem -v

@trein
Copy link
Author

trein commented Nov 6, 2013

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

@AxelWal
Copy link

AxelWal commented Nov 6, 2013

After gem update, it also works in my case.

@DanielKehoe
Copy link
Member

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

@ghost
Copy link

ghost commented Dec 5, 2013

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

@MichaelSvendsen
Copy link

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.

@itsNikolay
Copy link

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

@blaggacao
Copy link

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

@DanielKehoe DanielKehoe reopened this Jan 3, 2015
@SpaceG
Copy link

SpaceG commented Jan 15, 2015

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. ?

@itsNikolay
Copy link

@SpaceG
you could try this

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

@eoglethorpe
Copy link

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

@blaggacao
Copy link

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

@DanielKehoe
Copy link
Member

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.

@kevdowney
Copy link

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

@AndyFrontera
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests