好的,所以我对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.
行,但它在捆绑器中安装json时也遇到问题。
任何有用的建议或提示将不胜感激!
答案 0 :(得分:3)
首先按照说明进行操作(请避免sudo
):
不要以root身份运行Bundler。如果需要,Bundler可以要求sudo, 并以root身份安装捆绑包将破坏所有人的应用程序 这台机器上的非root用户。
要在linux
中解决此问题,请运行:
sudo apt install ruby2.3-dev
干杯!