I have a problem with my ruby version, rails and rvm.
when I go into my rails project directory, and run bundle install, I get a message saying:
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Fetching git://github.com/gregbell/active_admin.git
Using rake 10.4.2
Using i18n 0.7.0
Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.
Password:
I kill this job, and then run
rvm info
run the
bundle install
again, and everything is working fine.
I get different error depending on what command I'm running, but running rvm info after always solves the problem.
any idea?
Mike
Related
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!
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.
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.
I am building a new website on Rails and was able to successfully install the new Foundation 5 gem locally. When I pushed it to Heroku I have been getting the following message:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find foundation-rails-5.0.0 in any of the sources
Bundler Output: Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find foundation-rails-5.0.0 in any of the sources
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
Any ideas where I should go from here? Is there something I need to do on my end or is this on Heroku's end?
The first few versions of the gem were yanked.
Make sure your Gemfile points to a version 5.0.1.0 or greater.
I've had the same issue, and it's also been noted on Foundation's forum. The foundation-rails gem is pretty new (I just now updated to 5.0.2) and it still tanks. Probably just a matter of time until Heroku/Zurb work out the kinks.
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/