I have an Ansible playbook that installs Vagrant, and then instructs Vagrant to install a specific plugin. Vagrant has trouble installing a gem it needs, and says:
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `sudo gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
stdout: Installing the 'vagrant-aws --version '0.5.0'' plugin. This can take a few minutes...
While I have trouble installing Nokogiri using the command:
$ sudo gem install nokogiri -v '1.6.6.2'
as vagrant does it, I have found that I can install Nokogiri manually, using this command:
$ sudo gem install nokogiri -v 1.6.6.2 -- --use-system-libraries --with-xml2-include=/usr/include/libxml2
Even after I installed the gem manually, vagrant still fails if I manually tell it to install the plugin.
Is there a way to get better control of these dependencies so that vagrant won't fail and my playbook will complete?
It turns out I was missing some key dependencies: build-essential, libxslt1-dev, libxml2-dev, and zlib1g-dev. I found this comment here: https://github.com/mitchellh/vagrant-aws/issues/163#issuecomment-27603855 very helpful.
I believe it's an issue with using sudo to install the ruby gem.
I solved this issue by installing Ruby Version Manager, which installs and manages gems in your home directory.
After installing RVM I could install nokogiri without sudo, but vagrant-aws still failed to install until I re-installed vagrant. If you are building a fresh environment with Ansible then you can probably just install RVM before you install vagrant the first time (or any other ruby stuff). There are other ways to fix your gem permissions as well.
Here are the steps I took:
Install Ruby Version Manager (https://rvm.io/rvm/install)
curl -sSL https://get.rvm.io | bash -s stable --ruby
Install nokogiri without sudo
gem install nokogiri
Re-install vagrant (http://www.vagrantup.com/downloads)
Related
I'm using Ubuntu 16.10 and was updating my Gitlab from 6.8 to 7 and everything went wrong. Now I have removed it and is trying to install a new version but ran into a problem with Ruby.
When I try install it
$ sudo apt install gitlab
I get an error after some time:
Could not find gem 'rails (>= 4.2.7.1, ~> 4.2.7)' in any of the gem sources
listed in your Gemfile.
I have tried to run
$ sudo gem install rails
but this gives me another error:
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
I don't know what to do now...
I have started all over... Removed gitlab* and postgresql. Rebooted and installed gitlab again. Now I got another error:
Could not find gem 'pg (~> 0.18.2)' in any of the gem sources listed in your Gemfile.
Tried to install pg manually:
$ sudo gem install pg
Successfully installed pg-0.20.0
But still sudo apt upgrade gives the same error: "Could not find gem 'pg'
You may be missing a hidden dependency. Try the following:
sudo apt-get install libpq-dev
I gave up! I reinstalled the Linux server with the Linux LTS version and used the Omnibus package installation..
Problem solved!
I am an inexperienced Ruby user and I want to start using a Jekyll theme. I am working on OSX El Capitan and there may be old Ruby tools lying around on this machine.
I have downloaded this theme and installed it to a local directory. Next I tried to run bundle and saw this error:
An error occurred while installing nokogiri (1.5.9), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.9'` succeeds before bundling.
Full error output here: http://pastebin.com/mv2r91xU
Next, I tried running gem install nokogiri -v '1.5.9', but I saw this error:
-bash: /usr/local/bin/gem: No such file or directory
I don't know how to install gem, and I suspect I'm not using the "right" Ruby or bundler. Where should these tools be? What do I need to check I've deleted to start cleanly from scratch? (e.g. I tried setting up rbenv, but I think it may have failed because I already had RVM installed)
These are the paths to ruby and bundler:
$ which ruby
/usr/bin/ruby
$ which bundle
/usr/local/bin/bundle
I'd suggest using rbenv to manage your Ruby versions, and ignoring the default system-wide version. You mention you tried, but I think it'd be worth giving it another go.
rbenv is best installed through Homebrew, install it with the following:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then install rbenv with Homebrew:
$ brew install rbenv ruby-build
You can then set and switch between Ruby versions (giving you clean environments) anytime without changing the default system version:
$ rbenv install 2.3.1
$ rbenv global 2.3.1
$ ruby -v
Once Ruby is sorted, you should be able to install and run the latest Jekyll through the Bundler:
$ gem install jekyll
$ jekyll new my-awesome-site
$ cd my-awesome-site
$ bundle install
$ bundle exec jekyll serve
Running Jekyll through Bundler rather than directly is the new suggested method.
I'm facing this issue running
vagrant plugin install vagrant-berkshelf --plugin-version ">= 2.0.1"
I get this error
An error occurred while installing dep_selector (1.0.3), and Bundler
cannot continue. Make sure that gem install dep_selector -v '1.0.3'
succeeds before bundling.
I've seen mention of this issue including workarounds for Ubuntu, however I cannot find a workaround for mac OSX
https://github.com/berkshelf/vagrant-berkshelf/issues/191
https://github.com/berkshelf/berkshelf/issues/1138
Has anyone gotten around this on OSX?
From https://github.com/opscode/dep-selector/issues/28 I was able to get past this error with:
GEM_PATH=~/.vagrant.d/gems GEM_HOME=~/.vagrant.d/gems /Applications/Vagrant/embedded/bin/gem install dep_selector -v '1.0.3'
However there is also https://github.com/berkshelf/vagrant-berkshelf/issues/209
GEM_HOME=~/.vagrant.d/gems gem install dep_selector -v '1.0.3'
Which I assume may also work.
Unsure if the below played into this working for me (installing gecode from brew).
One of the issues you listed, links to: https://github.com/opscode/dep-selector-libgecode/issues/15
gem uninstall dep-selector-libgecode
gem uninstall dep_selector
USE_SYSTEM_GECODE=1 gem install dep-selector-libgecode
gem install dep_selector
This will fail... but the error message has this:
cd $( brew --prefix )
git checkout 3c5ca25 Library/Formula/gecode.rb
brew install gecode
I also did these steps as I was trying to solve this.
Time for all of us to move to Mavericks for ChefDK :)
I've been trying to install bro pages, but I'm hitting a wall.
I've managed to upgrade to Ruby 2.1.0:
craig#Craig-loaf:~$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
craig#Craig-loaf:~$ gem -v
2.2.1
But I try to install bro pages, like so:
craig#Craig-loaf:~$ sudo gem install bropages
ERROR: Error installing bropages:
mime-types requires Ruby version >= 1.9.2.
Which to me makes no sense.
I found some where on Stackoverflow a similar problem, where another gem had issues with being installed at they recommended adding --pre --no-ri --no-rdoc to the end, but I get this error instead:
craig#Craig-loaf:~$ sudo gem install bropages --pre --no-ri --no-rdoc
[sudo] password for craig:
ERROR: Could not find a valid gem 'bropages' (>= 0) in any repository
ERROR: Possible alternatives: bropages
craig#Craig-loaf:~$ sudo gem install mime-types --pre --no-ri --no-rdoc
ERROR: Could not find a valid gem 'mime-types' (>= 0) in any repository
ERROR: Possible alternatives: mime-types
So how can I get round this, and install bropages?
Is the sudo user set up to use a different ruby version (or any ruby version at all)? I've seen this happen before on UNIX machines where the main user is configured but the sudo user isn't. For example, the way I have things set up right now, > gem install {something} works fine, but > sudo gem install {something} claims it can't find the 'gem' command.
You might also try running without sudo. I don't sudo on my Linux machine, and I'm pretty sure my Mac doesn't require me to, either.
Try running 'sudo ruby -v' and 'sudo gem -v'. If that doesn't give you what you need to solve the issue, post the output to those commands here on the thread.
I got the above mentioned errors as well
I'm using Ubuntu 12.10 64bit.
bropages requires Ruby version 1.9.2, I had 1.8.7 installed. What fixed it for me is to install the latest version of ruby and install bropages gem in that so I could use it.
Here are the steps I took to install the latest version, and specify that as the one to use and to install bropages in that.
sudo apt-get update
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails
gem install bropages
Then finally I can use is like this:
bro curl
9 entries for curl -- submit your own example with "bro add curl"
# get the contents of a web page
curl http://bropages.org
bro thanks to upvote (22)
bro ...no to downvote (2)
Source: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
And http://bropages.org/
I uninstalled RVM and re-installed using a single user installation using:
\curl -L https://get.rvm.io | bash -s stable
When I do bundle, it prompts for:
Enter your password to install the bundled RubyGems to your system:
I tried using the answer in "ERROR: While executing gem … (Gem::FilePermissionError)" which did not fix it.
Then, while trying to install the gem manually, I got:
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
then running gem install nokogiri -v '1.6.0' returned:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
I checked all the similar posts on SO, but they didn't solve the problem. What am I missing?
I spent a lot of time fixing this issue on my MacBook. The gem update --system does not work for me.
At last, putting the following code in the ~/.zshrc file and create a new zsh session works for me.
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
after you install RVM you still need few more steps:
Load RVM to the current shell:
source ~/.rvm/scripts/rvm
Usually this would not be needed if you close and open your terminal again
Install ruby:
rvm install ruby
Use ruby:
rvm use ruby
The last step is very important as your error message mentioned system ruby not the one controlled by RVM.
Make sure to update your system rubygems with this command : sudo gem update --system --no-user-install.
bundler use it instead your local version and your bundler version could be incompatible with your system rubygems.
It works for me ;)