在EC2 ubuntu t1.micro实例上,使用RVM管理ruby。当黄瓜被添加到Gemfile并且捆绑器运行安装时,它会安装一些像gherkin这样的依赖宝石。
随后,当运行rails assets:precompile时,rvm会抛出以下权限错误。来自这里的任何指示都会有所帮助
$ 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'
通过删除gem并在本机上安装后续故障排除也会引发权限错误。
$ 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
答案 0 :(得分:0)
通过将失误作为sudo用户
运行解决了这个问题$rvmsudo bundle install
仍然不确定为什么非超级用户会出现权限问题。