install ruby gem - ruby-on-rails

I am trying to install the tabulous ruby gem by following this tutorial
I am getting stuck in a loop: run gem update => run gem => bundle install.
Can someone provide some information about how to proceed? I have already added the gem to Gemfile.
Here are the command outputs:
**22:16:35->gem update --system**
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.8.24
Updating RubyGems to 1.8.24
Installing RubyGems 1.8.24
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/commands/update_command.rb:153: warning: Insecure world writable dir /usr/local/git/bin/ in PATH, mode 040777
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Site/1.8/gauntlet_rubygems.rb
**22:17:33->bundle install**
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
/Library/Ruby/Gems/1.8/gems/bundler-1.2.3/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local/git/bin/ in PATH, mode 040777
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.5.0)
Using activesupport (3.2.11)
Using actionpack (3.2.11)
Using sass-rails (3.2.6)
Using sqlite3 (1.3.7)
Installing tabulous (1.3.0)
Gem::InstallError: tabulous requires RubyGems version >= 1.3.7. Try 'gem update --system' to update RubyGems itself.
An error occurred while installing tabulous (1.3.0), and Bundler cannot continue.
Make sure that `gem install tabulous -v '1.3.0'` succeeds before bundling.
22:18:03->gem install tabulous -v '1.3.0
> `
> '
ERROR: While executing gem ... (ArgumentError)
Illformed requirement ["1.3.0\n`\n"]
**22:18:39->gem install tabulous -v 1.3.0**
ERROR: Error installing tabulous:
tabulous requires RubyGems version >= 1.3.7. Try 'gem update --system' to update RubyGems itself.
22:26:25->gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.8.24
Updating RubyGems to 1.8.24
Installing RubyGems 1.8.24
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/commands/update_command.rb:153: warning: Insecure world writable dir /usr/local/git/bin/ in PATH, mode 040777
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Site/1.8/gauntlet_rubygems.rb

Try out
sudo gem update --system
Edit: I would also recommend doing as Kasumi commented and use rvm or rbenv. I had a hell of a time installing Ruby on Rails locally until I installed rbenv.

Related

Travis Running Gem Install Bundler Without Version

Travis is running the the command below and throwing an error:
$ gem install bundler
217ERROR: Error installing bundler:
218 The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.3.26. Try installing it with `gem install bundler -v 2.3.26`
219 bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
Now I don't know who told it to do that when I have the following in the .travis file:
before_install:
- gem install bundler -v 2.3.26
What could be causing travis to behave like this?

How to solve bundler LoadError

I am using rvm and running Ruby 2.6.1 and using rails 5.2.2. When I try bundler -v
I get the error:
Traceback (most recent call last):
3: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `<main>'
2: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `eval'
1: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `<main>'
/home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `load': cannot load such file -- /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundler (LoadError)
gem list bundler returns:
*** LOCAL GEMS ***
bundler (2.0.2, default: 1.17.3, 1.17.2)
bundler-unload (1.0.2)
rubygems-bundler (1.4.5)
It seems that it is trying to look for the file named "bundler" in /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/ folder but there is no such file. The required file is in a different folder:
ls /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/
> bundler
How can I set it such that the bundler -v command looks into the bundler-1.17.2/exe instead of the bundler-1.17.3/exe? In other words I need to set the default bundler version as 1.17.2 instead of 1.17.3
I have run:
gem uninstall bundler
gem install bundler
bundle install
Which install successfully but still I get an error with bundler -v.
A similar post suggest reinstalling Rails gem install rails -v 5.2.2 but this did not fix my issue.
You can try by uninstalling the bundler with version
gem uninstall bundler -v 2.0.2
gem uninstall bundler -v 1.17.3
gem uninstall bundler -v 1.17.2
and then check the gem list that bundler has been uninstalled
gem list bundler
If its get uninstalled then you can install bundler with version again
gem install bundler -v 1.17.2
Or if its not uninstalled then might be bundler gem is in your default gemset so you can use the default gemset and then try uninstalling and then install 1.17.2 again
rvm gemset use default
gem uninstall bundler -v 2.0.2
gem uninstall bundler -v 1.17.3
gem uninstall bundler -v 1.17.2
gem install bundler -v 1.17.2
I know this is quite old, but just to help anyone that is facing the same problem:
/home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `load': cannot load such file -- /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundler (LoadError)
You have to reinstall the exact version that ruby is complying. In the error message above, it was looking for bundler version 1.17.3.
So you should only reinstall this exact version.
gem install bundler -v 1.17.3

Gem install the wrong version of bundler

I had a problem with Bundler (bundle cannot load such file bundler-1.17.1/exe/bundle), so I removed Bundler then manually removed all bundler directory:
gem uninstall bundler -x
gem cleanup bundler
Then removed with rm -rf from:
~/.gem/ruby/2.5.1/gems/bundler-1.17.1
~/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1
and ~/.bundle
Now, I would like to reinstall bundler with the default version, 1.17.1.
So I tried gem install bundler
gem install bundler
Fetching: bundler-1.17.1.gem (100%)
Successfully installed bundler-1.17.1
Parsing documentation for bundler-1.17.1
Installing ri documentation for bundler-1.17.1
Done installing documentation for bundler after 3 seconds
1 gem installed
If I try to execute a bundle command, I get this error:
bundle
Traceback (most recent call last):
1: from /Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `<main>'
/Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `load': cannot load such file -- /Users/robin/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle (LoadError)
I can see bundler-1.17.1 in ~/.gem/ruby/2.5.1/gems/bundler-1.17.1 but not in .rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1. So I have to manually copy the folder:
cp -R ~/.gem/ruby/2.5.1/gems/bundler-1.17.1 ~/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1
But now, if I try a bundle command, it works but I have this message in first line:
Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.16.6). We suggest you upgrade to the latest version of Bundler by running 'gem install bundler'.
I tried to install bundler by gem install bundler -v 1.17.1 but I still have the problem.
gem list output:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 1.17.1)
capistrano-bundler (1.4.0, 1.3.0)
my config:
macOS 10.13.6
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
chruby
ruby-2.5.0
* ruby-2.5.1
rails -v
Rails 5.2.1
gem -v
2.7.7
EDIT:
I forgot to specify than gem pristine bundler doesn't work with bundler:
gem pristine bundler
Restoring gems to pristine condition...
Skipped bundler-1.17.1, it is a default gem
And if I try to uninstall bundler twice, I get this message:
gem uninstall bundler -x
ERROR: While executing gem ... (Gem::InstallError)
gem "bundler" cannot be uninstalled because it is a default gem
So i don't know if bundler is really uninstalled the first time.

How do I tell bundle install to use the version of Ruby on my PATH?

I'm trying to install my Rails 5 project on Debian. Either running bundle install with or without sudo results in an error complaining about not having the appropriate version of Ruby, even though when I run ruby -v after, you can see the version is 2.4. How do I point bundle install to the right version?
$ sudo bundle install
[sudo] password for myuser:
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.
Your Gemfile lists the gem jquery-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.6
Using minitest 5.10.3
Using thread_safe 0.3.6
Using tzinfo 1.2.3
Gem::InstallError: activesupport requires Ruby version >= 2.2.2.
An error occurred while installing activesupport (5.0.4), and Bundler cannot continue.
Make sure that `gem install activesupport -v '5.0.4'` succeeds before bundling.
$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [armv6l-linux-eabihf]
Running without sudo:
$ bundle install
Your Gemfile lists the gem jquery-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.6
Using minitest 5.10.3
Using thread_safe 0.3.6
Using tzinfo 1.2.3
Gem::InstallError: activesupport requires Ruby version >= 2.2.2.
An error occurred while installing activesupport (5.0.4), and Bundler cannot continue.
Make sure that `gem install activesupport -v '5.0.4'` succeeds before bundling.
$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [armv6l-linux-eabihf]
When you invoke bundle, first of all bundle itself gets resolved in $PATH. You can check, where the executable of it is located by typing whereis bundle or which bundle. In my case (Ubuntu 16.04) it's located in /usr/local/bin/bundle.
If we execute cat /usr/local/bin/bundle, we will get a content of this executable:
$ cat /usr/local/bin/bundle
#!/usr/bin/ruby2.4
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
load Gem.activate_bin_path('bundler', 'bundle', version)
As you can see, it's a plain Ruby script, and the top most line (#!/usr/bin/ruby2.4) sets the interpreter to execute it.
I suppose, that in your case there is an old Ruby version used, because if you had a Ruby in your system before installing 2.4.0, executable for gem didn't get updated for 2.4 and also uses old Ruby version. You can check this by doing which gem (for me /usr/bin/gem) and checking file contents with cat.
After that you can check available executables of gem by typing whereis gem:
$ whereis gem
gem: /usr/bin/gem /usr/bin/gem2.2 /usr/bin/gem2.4
Then you can just remove bundler by typing gem uninstall bundler (this should also remove it's executables) and install it again using correct gem, executing:
/usr/bin/gem2.4 install bundle
That should do the trick, because in executable for bundler you will get Ruby 2.4 as interpreter.
update-alternatives command can also be useful for such cases.
As you can see, it's such a headache, so my recommendation is either to use Ruby version manager (rvm, rbenv, etc.), or have only one Ruby version per machine.
gem install rails --version 5.0.0

Fedena installation in windows with ruby & rails

I am trying to install Fedena open sourse into my windows Have follow all the steps in fedena and wiki but still i am getting error Please help me here is my command lines and I am following this link of fedena http://projectfedena.org/install in these Getting error in "bundle install --local" Here is the Commands windows
C:\Users\Devil>cd c:\Fedena
c:\Fedena>bundle install --local
Some gems seem to be missing from your vendor/cache directory.
You have requested:
mysql = 2.8.1
The bundle currently has mysql locked at 2.8.1.
Try running `bundle update mysql`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
c:\Fedena>bundle update mysql
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies...
Using rake 0.8.7
Using activesupport 2.3.5
Using rack 1.0.1
Using cgi_multipart_eof_fix 2.5.0
Using daemons 1.2.4
Using declarative_authorization 0.5.1
Installing fastthread 1.0.7 with native extensions
Using fattr 2.2.1
Using gem_plugin 0.2.3
Using i18n 0.4.2
Installing mysql 2.8.1 with native extensions
Installing win32-open3 0.3.2 with native extensions
Using bundler 1.14.3
Using activerecord 2.3.5
Using activeresource 2.3.5
Using actionpack 2.3.5
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby/lib/ruby/gems/2.3.0/gems/fastthread-1.0.7/ext/fastthread
C:/Ruby/bin/ruby.exe -r ./siteconf20170201-7960-vtf9xv.rb extconf.rb
extconf.rb:13:in `block in <main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
from extconf.rb:12:in `open'
from extconf.rb:12:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby/lib/ruby/gems/2.3.0/gems/fastthread-1.0.7 for inspection.
Results logged to
C:/Ruby/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/fastthread-1.0.7/gem_make.out
An error occurred while installing fastthread (1.0.7), and Bundler cannot
continue.
Make sure that `gem install fastthread -v '1.0.7'` succeeds before bundling.
c:\Fedena>gem install fastthread -v '1.0.7'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing fastthread:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby/lib/ruby/gems/2.3.0/gems/fastthread-1.0.7/ext/fastthread
C:/Ruby/bin/ruby.exe -r ./siteconf20170201-3752-fbqr51.rb extconf.rb
extconf.rb:13:in `block in <main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
from extconf.rb:12:in `open'
from extconf.rb:12:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby/lib/ruby/gems/2.3.0/gems/fastthread-1.0.7 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/fastthread-1.0.7/gem_make.out
c:\Fedena>
I just completed my installation successfully. Below are steps I followed:
sudo gem install bundler
bundle install --local
gem install rails -v 2.3.5
sudo apt-get install libmysqlclient-dev mysql-server
gem install rake -v 0.8.7
gem install declarative_authorization -v 0.5.1
gem install i18n -v 0.4.2
gem install mysql
gem install rush -v 0.6.8
gem update --system 1.3.7
rake db:create
rake db:migrate
rake fedena:plugins:install_all
Launch with script/server
Make sure your ruby version is 1.8.7 and rake is 0.8.7
To install ruby 1.8.7 and set as default:
rvm install 1.8.7
rvm use 1.8.7 --default

Resources