gsmafra gsmafra - 11 days ago 7
Linux Question

Rails looking for wrong path of bundler

I'm trying to create a new Ruby-on-Rails application with a fresh installation on Linux. When I execute

rails new appname -d postgresql


I receive the following error

run bundle install --local
/usr/bin/ruby2.3: No such file or directory -- /usr/bin/bundle (LoadError)
run bundle exec spring binstub --all
/usr/bin/ruby2.3: No such file or directory -- /usr/bin/bundle (LoadError)


But
bundle
is installed in a different path:

$ which bundle
/usr/local/bin/bundle


Is it preferable to change the path of
bundle
or to specify to
rails
that it is in a different path? And what is the best way to do it (either changing the path or specifying it)?

Answer

add PATH=$PATH:$HOME/.gem/ruby/<version>/bin to your .bash_profile and source it.

Then you can install gems for your user without sudo with gem install bundler --install-dir ~/.gem

Comments