gpt4 book ai didi

ruby-on-rails - 无法在 linux : “Failed to build gem native extension” with ruby 2. 3 上安装 Rails

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:46:19 24 4
gpt4 key购买 nike

我正在尝试在 amazon-linux 实例上安装 rails,但我一直收到相同的错误报告 in this question :

[ec2-user@xxx.xxx ~]$ sudo gem install rails --no-ri --no-rdoc
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/ruby/gems/2.3/gems/nokogiri-1.7.2/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170529-26560-9zyb13.rb extconf.rb

注意我手动升级ruby到2.3

[ec2-user@xxx.xxx ~]$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux-gnu]

我也尝试过其他版本的 rails(我想安装最新的 5.1.1),但也不成功

sudo gem install rails --version 5.1.1 --no-ri --no-rdoc
sudo gem install rails --version 5.0.0 --no-ri --no-rdoc
sudo gem install rails --version 4.2.8 --no-ri --no-rdoc

这完全可能吗,还是我需要将 ruby​​ 降级到 2.0?

最佳答案

好像编译nokogiri时出错了。

nokogiri docs

Troubleshooting Ubuntu / Debian Installation

If you have issues, first make sure you have all the tooling necessary to compile C extensions:

  1. sudo apt-get install build-essential patch

It’s possible that you don’t have important development header files installed on your system. (This has never happened to me personally, but I have it on good authority that otherwise good and noble Ruby developers run into this.) Here’s what you should do if you should find yourself in this situation:

  1. sudo apt-get install ruby-dev zlib1g-dev liblzma-dev

关于ruby-on-rails - 无法在 linux : “Failed to build gem native extension” with ruby 2. 3 上安装 Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44239377/

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