ruby gem compass installation error - ruby-on-rails

I am trying to install gem compass, but I am getting the following error while running sudo gem install compass
Fetching: sass-3.4.22.gem (100%)
Fetching: multi_json-1.12.1.gem (100%)
Fetching: compass-core-1.0.3.gem (100%)
Fetching: compass-import-once-1.0.5.gem (100%)
Fetching: chunky_png-1.3.8.gem (100%)
Fetching: rb-fsevent-0.9.8.gem (100%)
Fetching: ffi-1.9.14.gem (100%)
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.14 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.14/ext/ffi_c/gem_make.out
My gem version is 1.8.23

please try this first.
xcode-select --install
sudo gem update --system
sudo gem install compass
If this not working then
sudo apt-get remove ruby
apt-get autoremove
sudo apt-get install ruby2.2(Change from your ruby version)
sudo gem install compass

Related

Cannot install spree gem - ERROR: invalid gem: package is corrupt

I'm trying to install the Spree gem, but it's giving me this error:
gem install spree
Fetching: httparty-0.13.3.gem (100%)
When you HTTParty, you must party hard!
Successfully installed httparty-0.13.3
Fetching: highline-1.6.21.gem (100%)
Successfully installed highline-1.6.21
Fetching: friendly_id-5.0.4.gem (100%)
Successfully installed friendly_id-5.0.4
Fetching: font-awesome-rails-4.2.0.0.gem (100%)
Successfully installed font-awesome-rails-4.2.0.0
Fetching: ffaker-1.25.0.gem (100%)
Successfully installed ffaker-1.25.0
Fetching: polyglot-0.3.5.gem (100%)
Successfully installed polyglot-0.3.5
Fetching: colorize-0.7.3.gem (100%)
Successfully installed colorize-0.7.3
ERROR: Error installing spree:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
I tried to uninstall and reinstall Nokogir again, with the same result.
When I tried sudo gem install nokogiri another error happened:
ERROR: Error installing nokogiri:
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/nokogiri-1.6.4.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.4.1/ext/nokogiri/gem_make.out
I think RubyGems didn't download the file properly. So, the system is reporting that the gem is corrupt.
Delete /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem and then install the gem again.
$ sudo rm /home/tarek/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/cache/nokogiri-1.6.4.1.gem
$ gem install nokogiri
Please make sure you install the following command:
sudo apt-get install libxslt-dev libxml2-dev
Now try installing Nokogiri. Be aware of sudo if you using RVM.
sudo gem install nokogiri
Hope my answer would be helpful.
Thanks.
Looks like you have the system Ruby installed.
You need to first do:
$ sudo apt-get install ruby-dev
and then do:
$ sudo gem install nokogiri
I'd encourage you to use Ruby Version Manager like RVM or rbenv for managing Ruby environments instead of using the system Ruby on your development environment.

Rails ERROR: While executing (Gem::RemoteFetcher::UnknownHostError)

I try to install rails with command gem install rails --no-ri --no-rdoc and then error occur.Below is output of error
gem install rails --no-ri --no-rdoc
Fetching: multi_json-1.7.8.gem (100%)
Successfully installed multi_json-1.7.8
Fetching: tzinfo-0.3.37.gem (100%)
Successfully installed tzinfo-0.3.37
Fetching: atomic-1.1.12.gem (100%)
Building native extensions. This could take a while...
Successfully installed atomic-1.1.12
Fetching: thread_safe-0.1.2.gem (100%)
Successfully installed thread_safe-0.1.2
Fetching: activesupport-4.0.0.gem (100%)
Successfully installed activesupport-4.0.0
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://rubygems.org/gems/rack-test-0.6.2.gem)
What should i do to solve this problem?
It looks like your source either isn't responding properly or the gem can't be found at the source.
Try gem install rack-test. If that gives you an error try switching the source you're getting the gem from.
First add the source
gem source -a 'https://production.cf.rubygems.org'
Then try installing again.
OR
You could try installing directly from a different source with
gem install rack-test --source 'https://production.cf.rubygems.org'
Once you get that gem to install properly, try installing rails again.

Not able to install rails version 3.2.x in linux mint 14.1

I am using Rails 2.3.14 problem is i want to update rails version to 3.2.x
1. sudo gem update rails
-Updating installed gems
-Nothing to update
2.when i used sudo apt-get update rails
-The update command takes no arguments
3.when i tried to install Rails sudo gem install rails --version=3.2.3
-Fetching: activesupport-3.2.3.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.3.gem (100%)
Fetching: rack-1.4.4.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: actionpack-3.2.3.gem (100%)
Fetching: activerecord-3.2.3.gem (100%)
Fetching: activeresource-3.2.3.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.3.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:1:in `'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Can anybody suggest me how can i overcome this issue.
first install
sudo aptitude install ruby1.9.1-dev
will solve your problem

Failed to build gem native extension — Rails install

I have been installing Ruby on Rails based on the instruction from edX online class.
Here is a list of terminal commands, and, where relevant, corresponding output:
$ sudo apt-get install ruby1.9.1
installation successful
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
$ tar zxvf ruby-1.8.24.tgz
$ cd ruby-1..8.24
$ sudo ruby setup.rb
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
* 1 bug fix:
* Install the .pem files properly. Fixes #320
* Remove OpenSSL dependency from the http code path
------------------------------------------------------------------------------
RubyGems installed the following executables:
/usr/bin/gem1.9.1
Up to here, everything looked fine, but the I tried to install rails and failed:
$ sudo gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
Fetching: builder-3.0.3.gem (100%)
Fetching: activemodel-3.2.8.gem (100%)
Fetching: rack-1.4.1.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.1.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.8.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.33.gem (100%)
Fetching: activerecord-3.2.8.gem (100%)
Fetching: activeresource-3.2.8.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.8.gem (100%)
Fetching: rake-0.9.2.2.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: thor-0.16.0.gem (100%)
Fetching: json-1.7.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
mkmf is part of the ruby1.9.1-dev package. This package contains the header files needed for extension libraries for Ruby 1.9.1. You need to install the ruby1.9.1-dev package by doing:
sudo apt-get install ruby1.9.1-dev
Then you can install Rails as per normal.
Generally it's easier to just do:
sudo apt-get install ruby-dev
The suggested answer only works for certain versions of ruby. Some commenters suggest using ruby-dev; that didn't work for me either.
sudo apt-get install ruby-all-dev
worked for me.
sudo apt-get install ruby-dev
worked for me

trouble installing rails on EC2

I am trying to install rails on my EC2 instance. I installed gem after reinstalling ruby. I am running ruby version 1.8.7 and gem version 1.8.12. I am trying to install rails and getting the following error.
*$ sudo gem install rails -v=3.1.1 Fetching: activesupport-3.1.1.gem (100%) Fetching: activemodel-3.1.1.gem (100%) Fetching: actionpack-3.1.1.gem (100%) Fetching: activerecord-3.1.1.gem (100%) Fetching: activeresource-3.1.1.gem (100%) Fetching: actionmailer-3.1.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.6.4 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.6.4/ext/json/ext/parser/gem_make.out*
Any ideas?
Thanks!
I've had a similar error when trying to install rails. The issue was that I had not installed the ruby-devel.i686 bundle. Granted this is on CentOS 6.3, but it seems like you may need to install this as well.

Resources