Bundle Install command won't install my gems? - ruby-on-rails

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!

Related

Can't create new rails project- ERROR: Failed to build gem native extension

I'm completely new to Ruby and Ruby on Rails, and trying to get my feet wet in it. Just installed Ruby and ROR on Win 10 64 bit, and from the command prompt seem successfully:
c:\>ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
c:\>rails -v
Rails 5.0.1
However, I can't create a project, it returns the following:
c:\>rails new demo
Using tilt 2.0.5
Using sqlite3 1.3.13
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.7.0.1
Using rack-test 0.6.3
Using sprockets 3.7.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe extconf.rb
C:/Ruby22-x64/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nio4r-1.2.1 for inspection.
Results logged to
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/nio4r-1.2.1/gem_make.out
An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
So the two major errors seem to be:
1) Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
I thought that would be resolved by installing DevKit, at https://rubyinstaller.org/add-ons/devkit/ but no cigar
2) C:/Ruby22-x64/bin/ruby.exe extconf.rb
C:/Ruby22-x64/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
I have no idea this error. C:/Ruby22-x64/bin/ruby.exe is the correct path to Ruby on my system. Can anyone shed some light?

Ruby On Rails Fails on Fresh Ubuntu, Mint, and Fedora Because of Debug inspector failing

I have tried in the last week with a fresh copy of Linux mint 18 Ubuntu 16.04 and fedora 24?(the latest one). All 3 give me the error with debug inspector.
xjackparsons93#93 ~/ty $ bundle install
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 11.2.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Installing debug_inspector 0.0.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20160808-7120-1xcia5udebug_inspector-0.0.2/gems/debug_inspector-0.0.2/ext/debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160808-7120-px14tj.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 /tmp/bundler20160808-7120-1xcia5udebug_inspector-0.0.2/gems/debug_inspector-0.0.2 for inspection.
Results logged to /tmp/bundler20160808-7120-1xcia5udebug_inspector-0.0.2/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
Using bundler 1.12.5
Installing byebug 9.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20160808-7120-1wwehr9byebug-9.0.5/gems/byebug-9.0.5/ext/byebug
/usr/bin/ruby2.3 -r ./siteconf20160808-7120-1p1pe88.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 /tmp/bundler20160808-7120-1wwehr9byebug-9.0.5/gems/byebug-9.0.5 for inspection.
Results logged to /tmp/bundler20160808-7120-1wwehr9byebug-9.0.5/extensions/x86_64-linux/2.3.0/byebug-9.0.5/gem_make.out
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Installing sqlite3 1.3.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20160808-7120-705k68sqlite3-1.3.11/gems/sqlite3-1.3.11/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20160808-7120-1mdxtv9.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 /tmp/bundler20160808-7120-705k68sqlite3-1.3.11/gems/sqlite3-1.3.11 for inspection.
Results logged to /tmp/bundler20160808-7120-705k68sqlite3-1.3.11/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/gem_make.out
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20160808-7120-1p1mgmsnokogiri-1.6.8/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160808-7120-f0fc55.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 /tmp/bundler20160808-7120-1p1mgmsnokogiri-1.6.8/gems/nokogiri-1.6.8 for inspection.
Results logged to /tmp/bundler20160808-7120-1p1mgmsnokogiri-1.6.8/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
Using rack-test 0.6.3
Using mime-types 3.1
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
I tried sudo gem install debug_inspector -v '0.0.2' , and the results were
xjackparsons93#93 ~/ty $ sudo gem install debug_inspector -v '0.0.2'
[sudo] password for xjackparsons93:
Building native extensions. This could take a while...
ERROR: Error installing debug_inspector:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20160808-8013-10my2bw.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/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out
This problem is not affecting my MacBook Pro only linux boxes
This can help you:
If you have issues, first make sure you have all the tooling necessary to compile C extensions:
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:
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
Please report it as a bug if this doesn’t work for you (see Getting Help for details).

Error installing bcrypt using bundle install

I am going to install some gems in my rails application using bundle install on Debian testing(stretch). I get this error:
Installing bcrypt 3.1.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 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 /tmp/bundler20151208-29851-hg3bi3bcrypt-3.1.10/gems/bcrypt-3.1.10 for inspection.
Results logged to /tmp/bundler20151208-29851-hg3bi3bcrypt-3.1.10/extensions/x86_64-linux/2.1.0/bcrypt-3.1.10/gem_make.out
An error occurred while installing bcrypt (3.1.10), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.10'` succeeds before bundling.
but I have installed bcrypt and bcrypt-ruby using gem install .
For gems with C extensions to compile, you'll need to install the ruby-dev package:
$ sudo apt-get install ruby-dev

Ruby not installing json -v 1.8.1 as part of bundle, ERROR: Failed to build gem native extension

I've tried installing using as part of the bundle and using sudo, but I get the same error message every time. I'm currently on Ruby 2.0.0 and Rails 4.1.8. I'm not sure what is going on. The exact error message below:
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.4.2 Using i18n 0.6.11
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20141218-80226-brqexc.rb extconf.rb mkmf.rb can't find
header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/json-1.8.1/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot
continue. Make sure that gem install json -v '1.8.1' succeeds before
bundling.
Any advice appreciated.
I've run into similar error on Ubuntu and all I needed to do was:
sudo apt-get install ruby-dev
For Mac, the following gist seems worth to have a look into: Setup mac for ruby dev

Trouble with Ruby on Rails OS X 1.8.4

I am having trouble with Ruby on Rails on my Mac. It may have something to do either with my version of xCode or OS X 1.8.4. I say this because I was able to create Ruby on Rails apps in the past.
Here is my problem. When I run rails new rubyDemo to create a new Rails app I get the following error:
create
create README.rdoc
create Rakefile
create config.ru
...
...
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Installing json (1.8.0) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Users/tithos/.bundler/tmp/9865/gems/json-1.8.0 for inspection.
Results logged to /Users/tithos/.bundler/tmp/9865/gems/json- 1.8.0/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.8.0), and Bundler cannot continue.
When I try to run sudo gem install json -v '1.8.0'
I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.8.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
I am running:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
rails -v
Rails 3.2.13
I have no idea what other gems and/or pieces I am missing.
Any help would be great
P.S. sorry for the long post

Resources