简体   繁体   中英

Bundle Install command won't install my gems?

Okay, so I'm very new to Rails, and am just beginning to feel my way around my new Linux operating system as well.

I'm currently doing a project for school, and I've followed all of the directions to perfection. For consistency purposes, they want specific versions of both rails and gemsets.

After I have initialized rails in my directory, I then run a bundle install command, and have several installation issues which I are in the code block as follows:

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.

The main error seems to be the Gem::Ext::BuildError: ERROR: Failed to build gem native extension. line, but it's also having problems installing json within the bundler.

Any helpful advice or tips would be appreciated!

First of all follow the instruction (please avoid 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.

To resolve this issue in linux , run:

sudo apt install ruby2.3-dev

Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM