1

サーバーで RVM を使用して Ruby を管理しています。非特権ユーザーとして実行したいデーモンである gem がありますが、そうしようとすると、アクセス許可エラーが発生します。

statusbot@host config]$ statusbot run
fatal: Not a git repository (or any of the parent directories): .git
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/definition.rb:235:in `rescue in lock': There was an error while trying to write to Gemfile.lock. It is likely that  (Bundler::InstallError)
you need to allow write permissions for the file at path: 
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/StatusBot-0.0.4/Gemfile.lock
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/definition.rb:220:in `lock'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/environment.rb:34:in `lock'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/runtime.rb:43:in `setup'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler.rb:120:in `setup'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/rubygems-bundler-1.1.1/lib/rubygems-bundler/noexec.rb:79:in `setup'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/rubygems-bundler-1.1.1/lib/rubygems-bundler/noexec.rb:91:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:9:in `<main>'

同様に、ユーザーごとに gem をインストールできません。

[statusbot@host ~]$ gem install ~/StatusBot-0.0.5.gem 
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /usr/local/rvm/gems/ruby-1.9.3-p374/gems/StatusBot-0.0.5
4

2 に答える 2

2

マルチ ユーザー モードで RVM を使用するには、次のものが必要です。

  1. RVM はsudonot rootuser を使用してインストールされます。
  2. ルビー/ジェムをインストールしたいすべてのユーザーはグループに属している必要がありますrvm(追加のユースケースは、OSX でrvmチェックしたときにグループに属している場合id1でも、シェルにはまだ効果がなく、再起動が必要になる可能性があります)。

追加の使用例は、RVM の一部のみがシステムにあり、ユーザーが で gemsets を作成できる混合モードです$HOME。詳細については、RVM サイト: https://rvm.io/rvm/installを参照してください。

于 2013-03-11T02:49:51.543 に答える
-1

https://stackoverflow.com/a/4151540/497756とそれに続く記事http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-によると、gem の問題のようです。バンドル作成者の 1 人からの the-gemspec-and-gemfile/Gemfile.lockは、gem の一部であってはなりません。

試す:

 sudo rm -f /usr/local/rvm/gems/ruby-1.9.3-p374/gems/StatusBot-0.0.4/Gemfile.lock
于 2013-03-10T22:09:20.487 に答える