gem - v or gem install bundler giving error rails - ruby-on-rails

Currently on my system i have installed rbenv and rvm both. when i do which ruby it gave me this /home/ijunaidfarooq/.rbenv/shims/ruby and on which rails it gave me /home/ijunaidfarooq/.rbenv/shims/rails.
but on doing gem install bundler it installs the gem but with an error
Error loading RubyGems plugin "/home/ijunaidfarooq/.rvm/gems/ruby-2.2.2#global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": cannot load such file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/home/ijunaidfarooq/.rvm/gems/ruby-2.2.2#global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers (LoadError)
as its showing that its going for .rvm/gems as per which ruby and which rails , its going in .rbenv/shims
even on doing gem -v its giving me this
Error loading RubyGems plugin "/home/ijunaidfarooq/.rvm/gems/ruby-2.2.2#global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": cannot load such file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/home/ijunaidfarooq/.rvm/gems/ruby-2.2.2#global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers (LoadError)
2.4.5
application is working totally fine on localhost but when i update some gems and deploy on awselasticbeanstalk , it gives me error which is
cannot load such file -- bundler/setup
any help will be appreciated.

Related

Rails: `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)

Ruby: 2.6.2
Rails: 6.0.3.4
I'm trying to run rails server and I keep getting this error:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
My gemfile reads:
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
I've tried installing sqlite3 to windows manually and tried chaning my gemfile to download version 1.3.11 with no luck.

Unable to install any ruby gems

I am trying to install Rails on my Mac. I keep getting a Jruby error or something of the sort:
gem install rails
Loading jruby-openssl in a non-JRuby interpreter
Error loading RubyGems plugin "/Users/User/.rvm/gems/ruby-2.4.0#global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": cannot load such file -- jruby (LoadError)
Loading jruby-openssl in a non-JRuby interpreter
Error loading RubyGems plugin "/Users/User/.rvm/gems/ruby-2.4.0#global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": cannot load such file -- jruby (LoadError)
Loading jruby-openssl in a non-JRuby interpreter
ERROR: Loading command: install (LoadError)
cannot load such file -- jruby
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
It looks like I have JRuby installed, which I think happened after I installed Java to install Netbeans. I used RVM to update ruby to 2.4. How do I get back to installing gems?
Thanks
rvm get stable --auto-dotfiles

Trying to install Rails, Failed to Build Gem Native Extension

I'm trying to install Rails on Ubuntu 12.10 using the Ruby Version Manager. I believe that Ruby and RubyGems are installed correctly, and these are my versions:
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
gem -v: 1.8.23
I'm trying to install rails, using
sudo gem install rails -v 3.2.9
This fetches a lot of gems, but has a problem building the native extensions:
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/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/json-1.7.5 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
Any idea what I'm doing wrong? If it helps, I'm trying to follow the tutorial at http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-install_rails.
Thank you!
Install the gem as a normal user, not sudo:
gem install rails
Or install the ruby dev package. There are a lot of similar answers in SO:
Failed to build gem native extension — Rails install
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
Do you have a C compiler installed? If not, you should run sudo apt-get install build-essential to set up a compiler toolchain

Replacing RVM with rbenv --mkmf error

I was looking at replacing RVM with rbenv since I am using bundle to manage my gemfiles. rbenv, I believe, is a lot lighter in managing my Ruby versions, so I uninstalled RVM and installed rbenv. I installed the bundler gem using
gem install bundler
because we need it everywhere. Then I opened a project and installed the required version Ruby using rbenv:
rbenv install 1.9.3-p194
rbenv local 1.9.3-p194
rbenv rehash
I entered ruby -v to make sure it was using the right version of Ruby, and it was, so I tried running bundle and it ran until it tried to install RedCloth and and then failed:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/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>'
It suggested that I install RedCoth before bundling, so I installed RedCloth:
gem install RedCloth
which succeeded. I then ran ruby -v, just to make sure it's still right, then tried running bundle update and the same error occured:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/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/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9 for inspection.
Results logged to /home/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I then tried installing a different version of Ruby but had no success there either.
Does anyone have ideas?
I subsequently tried doing the same thing in my other projects and it all seems to work just fine. I have one that uses 1.8.7 and it was as easy as setting the rbenv to the right version and then running bundle. I tried almost every combination of Ruby version and yet it's not working.
I had a similar problem. It turned out that, even though I had the ~/.rbenv/shims directory at the front of my path, zsh was caching the location of bundle to /usr/local/bin/bundle.
The solution was simply running rehash at the shell (not rbenv rehash). This flushed all the cached commands, including bundle, and all went well after that.
I finally overcame the problem.
I had installed a wrong version of Ruby 1.8.7-p370. I then ran bundle and that had some gems compiling the native extensions against Ruby 1.8.7 when the bundle was for a 1.9.3 package, so even if I was to switch over to the 1.9.3 version and try running bundle again it would bomb out.
To fix this, I simply removed all the gems and then installed the right version of Ruby and then re-ran bundle.

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet
I have require gdata/speadsheet in /Users/me/myapp/vendor/gems/roo-1.2.3/lib/roo/google.rb
I cannot figure out how to install it.
Tried
gem install gdata_spreadsheet
gem install spreadsheet
gem install gdata
Which all seem to install, but still get
no such file to load -- gdata/spreadsheet
When
ruby script/server.
Any ideas on how to get this file?
Assuming you are using bundler for dependencies try adding the gem to your Gemfile:
gem 'gdata_spreadsheet'
Then use bundler to install your dependencies and start your server:
bundle
bundle exec script/server

Resources