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.
Related
I am running bundle install command by going into my docker container and i am getting below error
root#internal:/srv/deviceservice# bundle install
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.
Fetching source index from https://gems.contribsys.com/
Fetching source index from https://gems.contribsys.com/
Fetching gem metadata from https://rubygems.org/..........
Fetching source index from https://rubygems.org/
Resolving dependencies................
RubyGems 1.8.23 is not threadsafe, so your gems will be installed one at a time. Upgrade to RubyGems 2.1.0 or higher to enable parallel gem installation.
Fetching rake 10.4.2
Zlib::DataError: invalid distance too far back
An error occurred while installing rake (10.4.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.4.2'` succeeds before bundling.
In Gemfile:
coffee-rails was resolved to 3.2.2, which depends on
railties was resolved to 3.2.21, which depends on
rake
root#internal:/srv/deviceservice# gem install rake -v '10.4.2'
ERROR: While executing gem ... (Zlib::DataError)
invalid distance too far back
root#internal:/srv/deviceservice#
My ruby version is 1.9.3 and rails version is '3.2.21' . i was not able to find anything related to this issue on the internet. any idea what this error is coming ?
It means the data is corrupted. Either in transit or at the source.
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
I get an error while trying to run the rails server. Seems like I can't install the json gem properly. When I first tried to install the gems, I got the 1.8.2 version of the json gem. For some reason I got the same error messages as attached when I tried to run the server. In order to install the 1.7.7 version of json, I have uninstalled the 1.8.2 gem.
Does anyone know how to fix this problem? Thank you in advance:)
$ rails s
Could not find json-1.7.7 in any of the sources
Run `bundle install` to install missing gems.
$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.0.3
[...]
Using rack-ssl 1.3.3
Errno::EACCES: Permission denied # rb_sysopen - /Users/annemarit/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/json-1.7.7/.gitignore
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
$ gem install json -v '1.7.7'
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/annemarit/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/json-1.7.7/.gitignore
When permission is denied, this can sometimes mean that you installed the gem with sudo permission meaning that you have to have root access to install/update. This happened once to me where I was installing everything with root access since I was signed in as root and forgot.
The solution I found was to uninstall everything and reinstall as non sudo. It was a painful process, but it fixed my no permission error. If you continue as root and keep installing everything as sudo, you will run into major problems later as well, so never run in sudo when developing RoR applications.
I hope this helps!
I add some gem to my gemfile.
Then i type :
$ bundle install
It will install the newly add gems in general , But it install the all gems, and it very slowly.
This is my terminal output:
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Enter your password to install the bundled RubyGems to your system:
Using rake (10.1.0)
Using i18n (0.6.5)
...
So:
How to make the bundle install fast, and i don't want it always install all gems
If you see Using gemname (version), it means the gem is already installed and Bundler doesn't reinstall it.
You need to bundle install all of your gems as there are dependency requirements between them. Bundler doesn't reinstall the gem's which state Using rake (10.1.0), but just confirms it's version to ensure gem dependency and prevent your application from producing runtime errors.
You can find out more information here:
http://bundler.io/
I've been following the railscast on setting up Vagrant with rails found here:
http://railscasts.com/episodes/292-virtual-machines-with-vagrant
I have rbenv running on vagrant with a slightly more updated version of ruby(1.9.3p125). Everything goes fine until I try to bundle. Here's the error I get:
vagrant#lucid32:/vagrant$ bundle
Fetching gem metadata from http:rubygems...
Fetching gem metadata from http:rubygems...
Resolving dependencies...
Using rake (10.0.3)
Errno::EPROTO: Protocol error - /vagrant/bin
An error occurred while installing rake (10.0.3), and Bundler cannot continue.
Make sure that gem install rake -v '10.0.3' succeeds before bundling.
I've tried gem installing that version of rake, then running rbenv rehash which seems to install, but running bundle again still gives me the same error.
I was able to resolve this by downgrading bundler from 1.3.2 to 1.2.5.
rvm use #global
gem uninstall bundler
gem install bundler -v 1.2.5
# switch back to the default gemset
rvm use
bundle install
# everything should work now
The only other thing that I changed was I reverted from rvm 1.18.19 to 1.17.10, but I am not positive that step is necessary.