gpt4 book ai didi

ruby-on-rails - 安装任何 gem 包时出错:::gem install rails 或 gem install dashing

转载 作者:数据小太阳 更新时间:2023-10-29 08:48:47 24 4
gpt4 key购买 nike

安装任何包时收到以下错误,我正在使用

gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib64/ruby/ruby.h


Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/atomic-1.1.14 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/atomic-1.1.14/ext/gem_make.out


# gem -v
2.1.5
# ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

任何人都可以帮助解决这个问题,因为我已经尝试更改 export PATH=$PATH:/ruby​​ 路径并尝试安装 ruby​​-dev 但无法在 ruby​​gems.com 上或通过 gems install 找到它ruby-dev 或 ruby​​-devel。

最佳答案

我有同样的问题:

gem install rails
Building native extensions. This could take a while...
ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/atomic-1.1.14 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/atomic-1.1.14/ext/gem_make.out

系统信息:

  [root@server ~]# uname -a
Linux server.com 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@server ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@server ~]# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

运行命令后:

yum install ruby-rdoc ruby-devel -y
gem update
gem update --system

我明白了:

[root@server ~]# gem install rails
Building native extensions. This could take a while...
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: activesupport-4.0.0.gem (100%)
ERROR: Error installing rails:
activesupport requires Ruby version >= 1.9.3.

而且我认为 CentOS 6.4 在默认存储库中不支持 Rails。为了解决问题,我们需要从源代码安装 ruby​​:

curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current

我们不需要删除默认的 ruby​​-1.8.x安装 rvm 后只需执行 source/etc/profile.d/rvm.sh感谢 rvm!!!

记住!要从 RVM 安装 rails,您需要在安装 ruby​​-1.9.3 后运行此命令:

gem update --system 1.8.25

我们这样做是为了避免错误:

/script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError)
from ./script/../config/boot.rb:60:in `load_initializer'
from ./script/../config/boot.rb:44:in `run'
from ./script/../config/boot.rb:17:in `boot!'
from ./script/../config/boot.rb:123
from script/server:2:in `require'
from script/server:2

关于ruby-on-rails - 安装任何 gem 包时出错:::gem install rails 或 gem install dashing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19254659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com