加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – gem install rails错误:执行gem时…(Errno ::

发布时间:2020-12-17 04:30:25 所属栏目:百科 来源:网络整理
导读:我以某种方式搞砸了我的$PATH. (改变了)我的ruby和铁轨宝石不起作用.我在解决这个问题上所做的是重新安装RVM.现在我的ruby在航站楼工作??得很好. 在运行gem install rails时我会遇到这样的问题: 许可被拒绝 – /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gem
我以某种方式搞砸了我的$PATH. (改变了)我的ruby和铁轨宝石不起作用.我在解决这个问题上所做的是重新安装RVM.现在我的ruby在航站楼工作??得很好.
在运行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时,我收到此错误:

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

我安装了XCode并安装了Command-Line工具.甚至继续安装GCC但在我尝试安装rails时遇到了同样的错误.

这是完整的错误消息

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

我是我的电脑管理员并运行Mac OS 10.8.3.我很感激rails安装的一些帮助.

编辑:
谢谢@Christoph
唯一有用的代码是实际删除RVM文件夹
sudo rm -rf~ / .rvm /
我只尝试卸载它没有用.因此,删除该文件夹,然后重新安装RVM就可以完成这项工作.

解决方法

就像Dave在那里指出的那样,不需要sudo任何Gem安装.您可以尝试重置RVM目录的权限:
sudo chown -R emKaro: ~/.rvm/

并再次尝试你的宝石安置.如果这不成功,您应该考虑删除RVM安装并重新开始:

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

在任何一个中都不应该使用sudo.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读