RVM权限被拒绝错误

时间:2015-06-30 07:04:17

标签: ruby rvm

我在运行Debian 7的机器上完成了RVM的多用户安装。我在机器上的项目使用ruby v2.2.2和gemset。我的项目根目录中有一个.ruby-version文件,内容为2.2.2@my-project-name 现在,当我进入我的项目目录时,我得到以下错误:

Regenerating ruby-2.2.2 wrappers........
rm: cannot remove `/usr/local/rvm/gems/ruby-2.2.2/environment': Permission denied
/usr/local/rvm/scripts/functions/environment: line 93: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 100: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 100: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied

有什么方法可以解决这个问题吗?

请帮助 谢谢。

1 个答案:

答案 0 :(得分:0)

在我的情况下,我意外地使用root用户而不是受限制的用户安装了新版本的Ruby。

你可以这样解决这个问题:

通过SSH登录您的服务器并转到目录/usr/local/rvm/gems/并查看以前版本的用户:

sreuter@localhost:/usr/local/rvm/gems$ ls -lah
total 28K
drwxrwsrwx  7 root    rvm 4.0K Mar 29 14:32 .
drwxrwsrwx 26 root    rvm 4.0K Feb 21 14:10 ..
...
drwxrwsr-x 10 sreuter rvm 4.0K Mar 29 13:36 ruby-2.4.0
lrwxrwxrwx  1 sreuter rvm   52 Feb 24 07:05 ruby-2.4.0@global -> /usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0
drwxrwsr-x 10 root    rvm 4.0K Mar 29 14:45 ruby-2.4.1
lrwxrwxrwx  1 root    rvm   52 Mar 29 14:32 ruby-2.4.1@global -> /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0

您会看到最新目录ruby-2.4.1及其符号链接属于root而不是受限用户作为其他目录。

按如下方式更改用户:

sudo chown -R sreuter:rvm ruby-2.4.1*

(根据需要更改用户和群组名称)