gpt4 book ai didi

ruby-on-rails - Bundle Install 命令不会安装我的 gem?

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

好吧,我是 Rails 的新手,我也刚刚开始熟悉我的新 Linux 操作系统。

我目前正在为学校做一个项目,并且我已经遵循了所有的指示以求完美。为了保持一致性,他们需要特定版本的 rails 和 gemsets。

在我的目录中初始化 rails 之后,我运行一个bundle install命令,还有几个安装问题我在代码块中如下:

user@user-ThinkPad-T430 ~/code/bloccit $ sudo bundle install
[sudo] password for user:
Don't run Bundler as root. Bundler can ask for sudo if it is needed,
and installing your bundle as root will break this application for all
non-root users on this machine.
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.....
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Installing json 1.8.6 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-1ah858h.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/json-1.8.6/gem_make.out
Using minitest 5.10.3
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using crass 1.0.3
Using rack 1.6.8
Using mini_mime 1.0.0
Using arel 6.0.4
Using bundler 1.11.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using thor 0.20.0
Installing ffi 1.9.18 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-1382ks7.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.18
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/ffi-1.9.18/gem_make.out
Installing pg 0.21.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/pg-0.21.0/ext
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-171n79p.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.21.0
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/pg-0.21.0/gem_make.out
Using rb-fsevent 0.10.2
Using tilt 2.0.8
Installing sqlite3 1.3.13 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-ml1ggl.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-
1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/sqlite3-1.3.13/gem_make.out
Using turbolinks-source 5.0.3
Using i18n 0.9.1
An error occurred while installing json (1.8.6), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.

主要错误似乎是 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 行,但在 bundler 中安装 json 时也有问题。

如有任何有用的建议或提示,我们将不胜感激!

最佳答案

首先按照说明(请避免sudo):

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.

要在 linux 中解决此问题,请运行:

sudo apt install ruby2.3-dev

干杯!

关于ruby-on-rails - Bundle Install 命令不会安装我的 gem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47543395/

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