Installing Bundle - Rails on Ubuntu

I am having a problem installing a package on a production server. I have a new droplet on DigitalOcean with Rails and Ubuntu 14.02. If I am root:

bundle install

      

I get the following message and my application crashes, start getting "Bad Gateway" errors from Nginx:

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.

      

If I run the package as rails user:

su rails
bundle install

      

then i get this error:

sh: 1: bundle: not found

      

What am I missing? I have browsed the internet and tried every solution I can find and cannot get it to work perfectly correctly.

Thank you for your help,

+3


source to share


3 answers


It looks like the Bundler gem is installed for the root user, but not for the rails user.



  • If you are not using Ruby Version Manager, such as rbenv or rvm, run: gem install bundler

    .

  • If you have a ruby ​​version manager your rails user does not have access to it because you only installed it for 1 user. In this case, your problem is that you cannot start the dispatcher. Maybe you don't have rails or even rubies for this user.

+2


source


The Ruby setup in the Rails on Rails One-Click app is controlled by RVM. If you run this package, you will see that the binary is installed to:

that links

/usr/local/rvm/gems/ruby-2.1.3/bin/bundle The rails user does not have a login shell, so you need to manually specify the /etc/profile.d/rvm.sh file to access the Ruby installation.



You can set the correct login shell for the rails user by running:

chsh -s / bin / bash rails

This worked for me and it should work for you as well. Thanks to

+1


source


I had this problem today when I deploy my web app to vps.

ruby version is controlled by RVM,

I am trying to install a new version of Ruby 2.2.2 but the problem occured

then try to install new vendor version, latest hardware set 1.12.3

gem uninstall bundler -v 1.12.3
gem install bundler -v 1.11.0

      

the problem should solve

+1


source







All Articles