gpt4 book ai didi

ruby-on-rails - 错误 : Failed to build gem native extension message (Linux) installing rubygems

转载 作者:行者123 更新时间:2023-12-04 03:46:22 25 4
gpt4 key购买 nike

我正在学习 Rails 教程 atm。 (我是初学者,请多多包涵。)

正如您在下面看到的,当我尝试使用“bundle install”安装 ruby​​gems 时,我收到一条错误消息,提示我需要确保“gem install json -v '1.8.1' 成功,然后再试一次.

但是当我尝试 sudo gem install json -v '1.8.1' 时,我得到了


.

如果我问的是一个愚蠢的问题,或者如果我遗漏了任何必要的信息,请告诉我。我是新手——CodeAcademy 和 RailsForZombies 是我的知识范围。

ben@ben-X551CA ~/first_rails_project/bens_first_app $ bundle installFetching gem metadata from https://rubygems.org/..........Resolving dependencies...Using rake 10.3.2Using i18n 0.6.11Using minitest 4.7.5Using multi_json 1.10.1Using thread_safe 0.3.4Using tzinfo 0.3.41Using activesupport 4.0.8Using builder 3.1.4Using erubis 2.7.0Using rack 1.5.2Using rack-test 0.6.2Using actionpack 4.0.8Using mime-types 1.25.1Using polyglot 0.3.5Using treetop 1.4.15Using mail 2.5.4Using actionmailer 4.0.8Using activemodel 4.0.8Using activerecord-deprecated_finders 1.0.3Using arel 4.0.2Using activerecord 4.0.8Using bundler 1.7.2Using coffee-script-source 1.8.0Using execjs 2.2.1Using coffee-script 2.3.0Using thor 0.19.1Using railties 4.0.8Using coffee-rails 4.0.1Using hike 1.2.3Using jbuilder 1.0.2Using jquery-rails 3.0.4

Your user account isn't allowed to install to the system Rubygems.You can cancel this installation and run:

bundle install --path vendor/bundle

将gems安装到./vendor/bundle/,或者你可以输入你的密码并使用 sudo 将捆绑的 gem 安装到 Rubygems。

密码:

Gem::Installer::ExtensionBuildError:错误:无法构建 gem native 扩展。

    /usr/bin/ruby1.9.1 extconf.rb 

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': 无法加载此类文件 -- mkmf (LoadError)
来自/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require' 来自 extconf.rb:1:in `'

Gem 文件将保留在/tmp/bundler20140908-2757-18q0kfn/json-1.8.1/gems/json-1.8.1 中以供检查。结果记录到/tmp/bundler20140908-2757-18q0kfn/json-1.8.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out安装json(1.8.1)时出错,Bundler无法继续。确保 gem install json -v '1.8.1' 在捆绑前成功。

ben@ben-X551CA ~/first_rails_project/bens_first_app $ gem install json -v '1.8.1'错误:执行 gem 时...(Gem::FilePermissionError) 您没有写入/var/lib/gems/1.9.1 目录的权限。ben@ben-X551CA ~/first_rails_project/bens_first_app $ sudo gem install json -v '1.8.1'构建 native 扩展。这可能需要一段时间...错误:安装 json 时出错: 错误:无法构建 gem native 扩展。

/usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': 无法加载此类文件 -- mkmf (LoadError)
来自/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require' 来自 extconf.rb:1:in `'

Gem 文件将保留安装在/var/lib/gems/1.9.1/gems/json-1.8.1 中以供检查。结果记录到/var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.outben@ben-X551CA ~/first_rails_project/bens_first_app $

最佳答案

所以运行这个对我有用:

sudo apt-get install ruby1.9.1-dev

假设需要 -dev 包?

关于ruby-on-rails - 错误 : Failed to build gem native extension message (Linux) installing rubygems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25722292/

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