Bundle install, rails command execution error An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.10' --source' https: // rubygems. org /'`successs before bundling. Solution

Error when running rails command after a long time.

An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.10' --source 'https://rubygems.org/'` succeeds before bundling.

If you get the above error, `bundle install` will not work either.

Cause

which gem、which rubyThe pass does not pass.

$ which ruby
/usr/bin/ruby

I want to do this ↓

$ which ruby 
/Users/shogo/.rbenv/shims/ruby

Solution

Add the following to the shell config file (.bashrc or .zshrc) to pass the path to rbenv.

Note that you have to do it line by line in the target app's directory.

[[ -d ~/.rbenv  ]] && \
  export PATH=${HOME}/.rbenv/bin:${PATH} && \
  eval "$(rbenv init -)"

Recommended Posts

Bundle install, rails command execution error An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.10' --source' https: // rubygems. org /'`successs before bundling. Solution
[Ruby on Rails] bundle install fails "An error occurred while installing pg (1.2.3), and Bundler cannot continue."