gem install rails错误:执行gem时(Errno :: EACCES) [英] gem install rails ERROR: While executing gem ... (Errno::EACCES)

查看:125
本文介绍了gem install rails错误:执行gem时(Errno :: EACCES)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知何故把我的$ PATH搞砸了。 (改变它)和我的红宝石和铁轨宝石不工作。我努力解决这个问题的方法是重新安装RVM。现在我的红宝石在码头工作良好。
运行 gem install rails 我得到了这样的欢迎:

权限被拒绝 - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb



当我尝试通过 sudo gem install rails 安装rails时,出现此错误:


错误:执行gem时(Errno :: EACCES)

安装了命令行工具的XCode也已安装。即使继续安装GCC,但在尝试安装rails时也会遇到同样的错误。



这是完整的错误消息

 错误:执行gem时(Errno :: EACCES)
权限被拒绝 - /Users/emKaro/.rvm/gems/ruby-2.0.0 -p247 / gems / atomic-1.1.13 / test / test_atomic.rb
emmanuels-imac:〜siaW $ sudo gem install rails
密码:
构建原生扩展。这可能需要一段时间...
错误:安装rails出错:
错误:无法构建gem本机扩展。

/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。

提供的配置选项:
--with-opt-dir
--without-opt-dir
--with-opt-include
- -without-opt-include = $ {opt-dir} / include
--with-opt-lib
--without-opt-lib = $ {opt-dir} / lib
--with-make-prog
--without-make-prog
--srcdir =。
--curdir
--ruby = / Users / emKaro / .rvm / rubies / ruby​​-2.0.0 -p247 / bin / ruby​​
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference -include
--without-atomic_reference-include = $ {atomic_reference-dir} / include
--with-atomic_reference-lib
--without-atomic_reference-lib = $ {atomic_reference-dir} /
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf .rb:434:在`try_do'中:编译器无法生成可执行文件。 (RuntimeError)
您必须先安装开发工具。来自/ Users / emKaro的/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in`try_link0'
中的
/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in`try_run'
from extconf.rb:24:in< main>'


Gem文件将保持安装在/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic- 1.1.13进行检查。
结果记录到/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out

我是我电脑的管理员,运行Mac OS 10.8.3。



编辑:
谢谢@Christoph
唯一有助于实际移除RVM的代码文件夹与
sudo rm -rf〜/ .rvm /
我只尝试卸载并且不起作用。因此,删除文件夹,然后重新安装RVM即可完成这项工作。

解决方案

像Dave指出那里,应该没有必要sudo任何Gem安装。您可以尝试重置您的RVM目录上的权限:

  sudo chown -R emKaro:〜/ .rvm / 

并再次尝试您的Gem instllation。如果不行,你应该考虑删除你的RVM安装并重新开始:

  sudo rm -rf〜/。 rvm /#删除你的RVM目录

实际上,没有必要在任何情况下使用sudo。

I somehow messed my $PATH up. (changed it) and my ruby and rails gems weren't working. What I did in efforts to fix this was to reinstall RVM. Now my ruby works fine in the Terminal. On running gem install railsI get greeted with this:

Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb

When I try to install rails through sudo gem install rails, I get this error:

ERROR: While executing gem ... (Errno::EACCES)

I have XCode installed with Command-Line tools installed as well. Even went ahead to install GCC but get the very same error when I try to install rails.

This is the full error message

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
emmanuels-imac:~ siaW$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
    --with-atomic_reference-dir
    --without-atomic_reference-dir
    --with-atomic_reference-include
    --without-atomic_reference-include=${atomic_reference-dir}/include
    --with-atomic_reference-lib
    --without-atomic_reference-lib=${atomic_reference-dir}/
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
    from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
    from extconf.rb:24:in `<main>'


Gem files will remain installed in /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13 for inspection.
Results logged to /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out

I am the admin of my computer and running Mac OS 10.8.3. I'd appreciate some help with the rails install.

EDIT: Thanks @Christoph The only code that helped was to actually remove the RVM folder with sudo rm -rf ~/.rvm/ I tried only to uninstal and it didn't work. So removing the folder and then reinstalling RVM does the job.

解决方案

Like Dave pointed out up there, there should be no need to sudo any Gem installation. You could try to reset the permissions on your RVM directory:

sudo chown -R emKaro: ~/.rvm/

and try your Gem instllation again. If that doesn't work out, you should consider removing your RVM installation and start over:

sudo rm -rf ~/.rvm/   # remove your RVM directory

There should really be no need for using sudo in any of this.

这篇关于gem install rails错误:执行gem时(Errno :: EACCES)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆