RailsApps / rails-composer

Rails Composer. The Rails generator on steroids for starter apps.
http://www.railscomposer.com/
3.38k stars 486 forks source link

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

Open trein opened 11 years ago

trein commented 11 years ago

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 commented 11 years ago

What are the Unix permissions for each directory?

00hello commented 11 years ago

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

AxelWal commented 11 years ago

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 commented 11 years ago

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

AxelWal commented 11 years ago

@trein: The Second Method works also not.

AxelWal commented 11 years ago

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

DanielKehoe commented 11 years ago

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

trein commented 11 years ago

@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 commented 11 years ago

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

trein commented 11 years ago

@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 commented 11 years ago

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

gem -v
trein commented 11 years ago

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

AxelWal commented 10 years ago

After gem update, it also works in my case.

DanielKehoe commented 10 years ago

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

ghost commented 10 years ago

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 commented 10 years ago

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 commented 9 years ago

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

blaggacao commented 9 years ago

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

SpaceG commented 9 years ago

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 commented 9 years ago

@SpaceG you could try this

chown your_username /Users/spaceodyssey/Desktop/hipster -R
eoglethorpe commented 9 years ago

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 commented 9 years ago

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

DanielKehoe commented 9 years ago

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 commented 9 years ago

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

AndyFrontera commented 8 years ago

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