简体   繁体   中英

RVM throws gems directory permission error during bundle install / rake assets:precompile

On an EC2 ubuntu t1.micro instance, using RVM to manage ruby. When cucumber was added to the Gemfile and bundler was ran to install , it installs some dependent gems like gherkin.

Subsequently, when rails assets:precompile is ran , rvm throws the following permissions error. Any directions from here would be helpful

 $ rake assets:precompile RAILS_ENV=production --trace
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /home/ubuntu/.rvm/gems/ruby-2.0.0-p353/extensions/x86_64-linux/2.0.0/gherkin-2.12.2 (Errno::EACCES)
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:203:in `each'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:210:in `write_gem_make_out'
    from /home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:132:in `build_error'

ON subsequent trouble shooting by removing the gem and installing it natively also throws permission error.

$ gem install gherkin
Fetching: gherkin-2.12.2.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
Permission denied - /home/ubuntu/.rvm/gems/ruby-2.0.0-p353/gems/gherkin-2.12.2/.gitattributes

This was resolved by running blunder as sudo user

$rvmsudo bundle install

Still not sure why the permission issue was coming for non super user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM