Error installing mongo gem on ubuntu - ruby

I am running ubuntu 14.04.3 LTS on an Amazon EC2 instance. Any help resolving this error would be much appreciated.
Typing sudo gem install mongo yields the following:
Fetching: bson-3.2.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mongo:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/bson-3.2.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bson-3.2.1/ext/bson/gem_make.out

Another question - `require': no such file to load -- mkmf (LoadError) - has an answer which should fix the problem for you;
sudo apt-get install ruby1.9.1-dev
sudo apt-get install ruby-dev

Related

Ruby Project Run time Error- require': cannot load such file -- bundler (LoadError)

I tried running a gitproject , https://github.com/jmopr/job-hunter
in RubyMine IDE. And while running the project from menu in RubyMine IDE, the error produced is this.
--------------------------(START)-Output for run of project------------
/usr/bin/ruby /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails server -b 0.0.0.0 -p 3000 -e development
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/spring:8:in <top (required)>'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails:3:inload'
from /Applications/software/projects/gitprojects/job-hunter_rb/bin/rails:3:in `'
Process finished with exit code 1
--------------------------(END)-Output for run of project------------
Specs:
Ruby Version (ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin16] )
rails -v
Could not find proper version of railties (4.2.5.1) in any of the sources
Run bundle install to install missing gems.
Its seems you are missing the bundler gem which is the gem responsible for installing all other gems.
1) Install bundler first gem install bundler
2) Use bundler to install the other gems, so from the root directory of the project, run bundle install
Hopefully that should sort it out

Getting errors when installing Compass

I'm running Ubuntu with ruby:
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
got Sass 3.4.9 installed and now I'm trying to install Compass from http://compass-style.org/install/ but when running gem install compass am getting errors:
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/bin
/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.6/ext/ffi_c/gem_make.out
this is the log file content:
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
I've been googling for hours and am still stuck. How to solve it?
There is a issue.
You can see more info here:
https://github.com/sass/sass/pull/1527 > https://github.com/guard/listen/issues/275

Failure at "bundle-install"

I am trying to work on a new project on Ubuntu. After cloning the GitHub repo and installing ruby sudo apt-get install ruby, y perform
bundle install
and I get this feedback:
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4)
Using coderay (1.0.9)
Using coffee-script-source (1.6.2)
Using multi_json (1.7.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Installing ffi (1.8.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /home/dbugger/.bundler/tmp/24874/gems/ffi-1.8.1 for inspection.
Results logged to /home/dbugger/.bundler/tmp/24874/gems/ffi-1.8.1/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.8.1), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.8.1'` succeeds before bundling.
What am I missing?
Try sudo apt-get install ruby1.9-dev.
Then bundle install again.
As an aside you probably want to not mess with the system ruby and install ruby locally instead with rbenv or rvm.

custom_require.rb load error in eventmachine installation

I'm having a problem with my gems dependencies: the content of the Gemfile is
source :gemcutter
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
And a bundle install hit me with this error
$ sudo bundle install
The source :gemcutter is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
Using addressable (2.2.7)
Using crack (0.1.8)
Using daemons (1.1.3)
Installing eventmachine (0.12.10)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-0.12.10 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.
However, I do have eventmachine installed!:
$ gem list
*** LOCAL GEMS ***
eventmachine (1.0.3, 1.0.0.rc.4, 0.12.10)
Help me, you're my only hope! Thank you.
ruby 1.9.1 had some issues with C extensions. Try to check if you have mkmf:
locate mkmf
or install dev version of ruby 1.9.1:
sudo apt-get install ruby1.9.1-dev
I recommend to use RVM for installing rubies: https://rvm.io/
You can also try to change source in your Gemfile
source 'https://rubygems.org'
instead of :gemcutter

error Installing linecache19 gem bundler rvm

I'm failing to install linecache19 gem via bundler with an rvm installation of ruby 1.9.2 on aptosid (ie debian sid).
I am new to ruby but my ruby installation is clearly not completely mis-configured as I have been able to install rails and a bunch of gems.
The output I get is the following:
Installing linecache19 (0.5.12) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/caz/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
/home/caz/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- openssl (LoadError)
ms/custom_require.rb:36:in `require'
in `<top (required)>'
ms/custom_require.rb:36:in `require'
from /home/caz/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/caz/.rvm/gems/ruby-1.9.2-p320/gems/ruby_core_source-0.1.5/lib/contrib/uri_ext.rb:11:in `<top (required)>'
from /home/caz/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/caz/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/caz/.rvm/gems/ruby-1.9.2-p320/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from extconf.rb:2:in `<main>'
Gem files will remain installed in /home/caz/.rvm/gems/ruby-1.9.2-p320/gems/linecache19-0.5.12 for inspection.
Results logged to /home/caz/.rvm/gems/ruby-1.9.2-p320/gems/linecache19-0.5.12/ext/trace_nums/gem_make.out
An error occured while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.
I have tried the solution which is usually suggested:
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p320
I have also tried using the --force option without success as per the following:
Installing Gems without rvm, as root, with explicit version of ruby
I'm confused by the presence of "1.9.1" in the path reported in the output- I wonder whether this is a hangover of the debian ruby package and the source of my problems.
ps this is all in aid of installing the Smallest Federated Wiki. I encourage readers to take a look at this project.
in your terminal enter rvm requirements
It will provide you with something like
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
go ahead and copy the command and run it. It will install all dependencies required for running ruby.

Resources