Bundler cannot load gem rake - ruby-on-rails

I'm currently SSH'd into a remote server where I am trying bundle install, but here is the message that it spits out when I run it:
Fetching gem metadata from http://rubygems.org/...........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
sudo: effective uid is not 0, is sudo installed setuid root?
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-12.0.0.gem] in /home2/shsprogr/rails/Frothy-Fox
An error occurred while installing rake (12.0.0), and Bundler cannot continue.
Make sure that `gem install rake -v '12.0.0'` succeeds before bundling.
And yet, when I run gem install rake -v '12.0.0':
Successfully installed rake-12.0.0
1 gem installed
Installing ri documentation for rake-12.0.0...
Installing RDoc documentation for rake-12.0.0...
Yet the same thing happens with bundler above. If it helps, I'm on a bluehost server and I am unable to enable sudo access because this guide is out of date.

You're likely going to find several things with Bluehost rails a challenging affair. You might consider creating a free developer account on Heroku instead. It will make this process a little easier.
However, you can fix your issue by setting a GEM_HOME in your htaccess file. This is going to make sure that gems are installed in your web directory of the shared bluehost server - so they won't run into the kinds of issues that require sudo. So open your .httacess file in your favorite editor and add this line:
SetEnv GEM_HOME /home2/shsprogr/ruby/gems

Related

ruby on rails gem file installation install bundle

I am new with ruby on rails. I have successfully installed ruby on rails 4.2 on Ubuntu 14.04 and created a new app, but when I started the server to see if it is working by writing:
rails server
I get this error message:
Could not find gem 'sass-rails (~> 5.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
And when I start to install bundle I get other packages that need to be installed before bundle.
Error message for bundle install
Gem::RemoteFetcher::FetchError: Errno::EHOSTUNREACH: No route to host - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/minitest-5.5.1.gem)
An error occurred while installing minitest (5.5.1), and Bundler cannot
continue.
Make sure that `gem install minitest -v '5.5.1'` succeeds before bundling.
then after I installed minitest and run bundle install
I got this error message
Gem::RemoteFetcher::FetchError: Errno::EHOSTUNREACH: No route to host - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/debug_inspector-0.0.2.gem)
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
It keeps showing me packages that I need to install before bundle.
I'm not on Ubuntu, but I find with Rails 4+ this step-wise gem install is the rule rather than the exception. It doesn't seem to handle dependency gem installs very well with bundle. For each of the "missing" dependency gems, run the single gem install, and then the bundle again to see what's next It may reveal another dependency with each step, just install that. (The caveat is if you're seeing the same gems show up as not being installed on every bundle exec, then that's another problem altogether. Once you single-install the gem it should be locked in and available)
$gem install bundle
$gem install name-of-flagged-gem
$gem install bundle
$gem install next-missing-gem
Hope this helps.
Your solution should be right here: SSL Error
I had the same exact problem. Each time I did a "bundle install" it told me to make sure "gem install .... succeeds before bundling" And when I did what it said, it just told me about another gem.

Rails: Could not find minitest-4.7.5 in any of the sources

Here is a trouble: on my remote server command gem list shows:
some gems
minitest (4.7.5)
....
bundle show minitest command shows:
/var/lib/gems/1.9.1/gems/minitest-4.7.5
bundle show rails shows the same directory
bundle -v - 1.6.2 (the latest version)
But I've an error: Could not find minitest-4.7.5 in any of the sources (Bundler::GemNotFound)
The steps I've made
Delete Gemfile.lock and bundle install again
Reinstall bundler
Ruby version 2.1.2
Bundle install output shows Using minitest (4.7.5)
On the remote server run gem update bundler and after bundle install.
I think maybe the gems you installed system-wide cause the problem.
You may try bundle package locally, and commit the gems generated in vendor/cache. Pull it on server, and try bundle install —local.
Or, you may just use bundle install --path=vendor/bundle on server.
Give it a try, and hope this can help.

issues deploying Rails site

I am attempting to deploy a site on a commercial hosting service. (JustHost.com)
I am having the following issue running bundle
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.3.0.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (10.3.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.0'` succeeds before bundling.
I am able to successfully run the gem install command:
# gem install rake -v '10.3.0'
Successfully installed rake-10.3.0
1 gem installed
Installing ri documentation for rake-10.3.0...
Installing RDoc documentation for rake-10.3.0...
But I get the same error re-running bundle. Furthermore, I don't think I was actually able to install rake - its location is not writable by me and the version is unchanged:
# which rake
/usr/bin/rake
# rake --version
rake, version 0.9.2.2
I also tried updating my Gemfile to use rake 0.9.2.2. but ran into the same issue:
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-0.9.2.2.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.
Any help appreciated!
What I did to get around this was update the .bashrc file per the instructions here. I also had to setup a javascript runtime so I used gems rubyracer with execjs.

Error while bundling Rails application (missing gems?)

Note: this is my first attempt with Ruby and Rails!
Once I've installed everything I tried to create a new app with
rails new rubyapp
the command created everything and then the bundler started. While running it stopped at
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/coffee-script-source-1.6.2.info
An error occurred while installing coffee-script-source (1.6.2), and Bundler cannot continue.
Make sure that `gem install coffee-script-source -v '1.6.2'` succeeds before bundling.
well.. no problem.. let's install this..
sudo gem install -p http://myproxy:8080 coffee-script-source -v '1.6.2'
Installing ri documentation for coffee-script-source-1.6.2
1 gem installed
Good. Try again.
bundle install
and stopped here:
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/execjs-1.4.0.info
An error occurred while installing execjs (1.4.0), and Bundler cannot continue.
Make sure that `gem install execjs -v '1.4.0'` succeeds before bundling.
!!!
Needless to say that I've installed this, tried again and the same error came up with different "gems".
My question is: is there a command to find if I've everything I need installed without doing these steps tons of times (also because they're pretty slow..)?
I've also tried bundling with sudo but maybe it's not working for the proxy.. : /
Thanks in advance
Just to help anyone still looking (I presume you fixed it in the end) running the command sudo chown myuser:myuser /Library/Ruby/Gems/1.8/build_info/ (where /Library/Ruby/Gems/1.8/build_info/ is the directory referenced in the error) fixed this.
I encourage you to install RVM (or rbenv) to install/uninstall ruby interpreters. Ruby interpreter bundled with Mac OS X is too old. Also gem installation procedure for system ruby interpreter requires superuser privileges.
If it is your first attempt to Rails world, please, start it with right tools, and actual ruby version (1.9.3).
Here you can find how to install RVM: https://rvm.io/rvm/install/
Good luck!

I'm having trouble running my Rails web server

I have installed ruby193 and I've installed rails via the command prompt (I also installed a DevKit). However, whenever I try the command:
rails server
I get this error:
←[31mCould not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available
on this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
I've tried a bundle install and it gives me an error with when trying to install the json gem. Any suggestions?
make sure in your Gemfile you are including the right gem (no misspellings, etc)
Looks like you are on Windows.
I defeated the very same problem on Windows by manually installing my gems from Gemfile (gem install gem_to_install). After successfully installing a particular gem I ran bundle check to see what else I need to install. And this way after few installed gems I ran bundle check again and saw the output The Gemfile's dependencies are satisfied.
And then server started. I wish you the same!
P.S. You can install few gems at once: gem install gem1 gem2.

Resources