custom_require.rb load error in eventmachine installation - ruby

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

Related

Requiring pry gem into ruby script causes error

I am using ruby version 2.3.3p222
Here is my Gemfile:
# Gemfile
source 'https://rubygems.org'
gem 'pry'
I run bundle and here is the resulting Gemfile.lock
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.2)
method_source (0.9.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
PLATFORMS
ruby
DEPENDENCIES
pry
BUNDLED WITH
1.15.1
I then simply run a ruby script via ruby my_report.rb (this script is located in the same directory as Gemfile and Gemfile.lock). my_report.rb only has this in the file:
require 'pry'
Here is the error:
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/<user>/.rvm/gems/ruby-2.3.3/gems/pry-rescue-1.4.5/lib/pry-rescue.rb:15: warning: method BaseHelpers#windows? is deprecated. Use Pry:Helpers::Platform.windows? instead
/Users/<user>/.rvm/gems/ruby-2.3.3/gems/pry-stack_explorer-0.4.9.2/lib/pry-stack_explorer.rb:128:in `<top (required)>': undefined method `before_command' for #<Pry::CommandSet:0x007fccdcf0b1e8> (NoMethodError)
Question: What am I missing? How can I properly require in pry into my ruby script so that I can set breakpoints?
What eventually worked for me is I just uninstalled all of the pry versions I had installed via gem uninstall. Then: in my gemfile I specified a previous version of 0.11.3:
# Gemfile
source 'https://rubygems.org'
gem 'pry', '0.11.3'
I did bundle install and then ran my ruby script, and that worked for me.

Ruby Compass Compiler not working, error on line [54]

Ruby Compass not working, code is bellow, and I've tried 10-20 methods on the web, any suggestions ?
In the screenshot you'll find an easier way to read the terminal dump of my gems and the error, in case you want to take something from there, you'll find the text under the screenshot
Thanks,
Cheers,
Robert
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help gem_dependencies gem dependencies file guide
gem help platforms gem platforms guide
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://guides.rubygems.org
sh-3.2# gem list
*** LOCAL GEMS ***
bigdecimal (1.2.5, 1.2.0)
CFPropertyList (2.2.8, 2.2.0)
chunky_png (1.3.1)
compass (1.0.1)
compass-core (1.1.0.alpha.0, 1.0.1)
compass-import-once (1.0.5)
ffi (1.9.3)
io-console (0.4.2)
json (1.8.1, 1.7.7)
libxml-ruby (2.7.0, 2.6.0)
mini_portile (0.6.0)
minitest (5.4.1, 4.3.2)
multi_json (1.10.1)
nokogiri (1.6.3.1, 1.5.6)
power_assert (0.1.3)
psych (2.0.5, 2.0.0)
rake (10.3.2, 0.9.6)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rdoc (4.1.1, 4.0.0)
rubygems-update (2.4.1)
sass (3.4.2)
sqlite3 (1.3.9, 1.3.7)
test-unit (3.0.1, 2.0.0.0)
sh-3.2# compass compile -e production --force
LoadError on line ["54"] of /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- rgbapng
Run with --trace to see the full backtrace
Fixed by installing the following compass extensions :
gem install compass-normalize
gem install compass-rgbapng
gem install toolkit
That did not fix it for me. However, I was able to fix it by reinstalling the compass gem using
gem uninstall compass
gem install compass
I think you can probably fix it even easier by just updating the compass gem to the latest version using gem update compass.
Note: If you use rails, you might also have to update your compass-rails gem. Otherwise, the compass watch command will start to hang. See this issue on github

Bundler stops at gem json install

I tried to install susy2 /sass / compass with bundler.
My Gemfile:
source "https://rubygems.org"
gem 'sass', '~> 3.3.2'
gem 'susy', '~> 2.1.1'
gem 'json', '~> 1.8.1'
gem 'compass', '~> 1.0.0.alpha.19'
bundle install shows the error
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 /home/bernie/.bundler/tmp/6210/gems/json-1.8.1 for inspection.
Results logged to /home/bernie/.bundler/tmp/6210/gems/json-1.8.1/ext/json/ext/generator/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.
gem list shows:
bundler (1.5.1)
celluloid (0.15.2)
chunky_png (1.3.0)
compass (0.12.4)
compass-core (1.0.0.alpha.19)
compass-import-once (1.0.4)
fssm (0.2.10)
multi_json (1.9.2)
permutation (0.1.8)
rake (10.2.0)
rb-fsevent (0.9.4)
sass (3.3.4, 3.2.18)
susy (2.1.1)
timers (1.1.0)
Any Ideas?
A little bit Googling told me this, have you tried it?
sudo apt-get install ruby1.9.1-dev

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.

Why is bundler using an old version of ruby, and not recognizing new gems that are installed?

In my Heroku/Sinatra app I set up my gemfile with Ruby 1.8.7 and then later used RVM to set my default to 2.0.0. Now when I try and install any new gems such Sinatra-flash or Pony, the gems aren't recognized or found when I require them in my main.rb file.
When I add gem "pony" in my gemfile I get a popup message saying:
Gem 'pony' is not available in SDK 'ruby-1.8.7-p385'
even though I've installed it. When I type gem list into the terminal, it returns all the gems I've installed that aren't being recognized as installed in my program.
If I add require 'sinatra/flash' or require 'pony' in my main.rb, I get a message:
no such file to load
I'd really appreciate any help on this, this has been driving me nuts.
Edited:
Using command sudo gem install 'gemname'
When I enter rvm info I get back
ruby :
interpreter: "ruby"
version: "2.0.0p195"
date: "2013-05-14"
platform: "x86_64-darwin12.3.0"
patchlevel: "2013-05-14 revision 40734"
full_version: "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]"
homes:
gem: "/Users/adam419/.rvm/gems/ruby-2.0.0-p195"
ruby: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195"
binaries:
ruby: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/ruby"
irb: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/irb"
gem: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/gem"
rake: "/Users/adam419/.rvm/gems/ruby-2.0.0-p195#global/bin/rake"
environment:
PATH: "/Users/adam419/.rvm/gems/ruby-2.0.0-p195/bin:/Users/adam419/.rvm/gems/ruby-2.0.0-p195#global/bin:/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/adam419/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/git/bin/[["
GEM_HOME: "/Users/adam419/.rvm/gems/ruby-2.0.0-p195"
GEM_PATH: "/Users/adam419/.rvm/gems/ruby-2.0.0-p195:/Users/adam419/.rvm/gems/ruby-2.0.0-p195#global"
MY_RUBY_HOME: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195"
IRBRC: "/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/.irbrc"
RUBYOPT: ""
gemset: ""
Edit: After I enter 'rvm use ruby-2.0.0' and then 'bundle install'
I get;
Adams-MacBook-Pro:songs adam419$ rvm use ruby-2.0.0
Using /Users/adam419/.rvm/gems/ruby-2.0.0-p195
Adams-MacBook-Pro:songs adam419$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'sinatra/flash (>= 0) ruby' in the gems available on this machine.
After changing from gem "sinatra/flash" to gem "sinatra-flash" and then running bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Enter your password to install the bundled RubyGems to your system:
Using addressable (2.2.8)
Installing daemons (1.1.9)
Using data_objects (0.10.12)
Using dm-core (1.2.0)
Using dm-do-adapter (1.2.0)
Installing dm-migrations (1.2.0)
Using do_sqlite3 (0.10.12)
Using dm-sqlite-adapter (1.2.0)
Installing eventmachine (1.0.3)
Using rack (1.5.2)
Using rack-protection (1.5.0)
Using sass (3.2.9)
Using tilt (1.4.1)
Using sinatra (1.4.2)
Using sinatra-flash (0.3.0)
Installing temple (0.6.5)
Installing slim (1.3.9)
Installing thin (1.5.1)
Using bundler (1.3.5)
Your bundle is complete!
Gems in the group production were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Current Gemfile
source 'https://rubygems.org'
gem "sinatra"
gem "slim"
gem "sass"
gem "dm-core"
gem "sinatra-flash"
gem "dm-migrations"
gem "thin"
gem "pg", :group => :production
gem "dm-postgres-adapter", :group => :production
gem "dm-sqlite-adapter", :group => :development
Gemlock file dependencies
DEPENDENCIES
dm-core
dm-migrations
dm-postgres-adapter
dm-sqlite-adapter
pg
sass
sinatra
sinatra-flash
slim
thin
By using sudo gem install pony you're triggering the system Ruby install which is different from RVM's version. Do not use sudo. Just make sure that RVM is loaded, then use the correct version of your ruby:
rvm use ruby-2.0.0
Then run bundler:
bundle install
This should give you the full environment.
I had the same problem and i deleted my rubymine .idea file and now its working fine.

Resources