Problem with Bundle Install - Rails on Ubuntu

  • Posted on December 18, 2014
  • bradm933Asked by bradm933

I have a problem with bundle install. I have a fresh droplet with Rails and Ubuntu. If I run as root:

bundle install

I get the following message and my application breaks, 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 bundle install as the rails user:

su rails
bundle install

then I get this error:

sh: 1: bundle: not found

What am I missing? I’ve scoured the internet and tried every solution I can find and can’t get it working quite right.

Thanks for your help,

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The ruby installation on the Rail on Rails One-Click application is managed by RVM. If you run which bundle you can see that the binary is installed to:

# which bundle

The rails user doesn’t have a login shell, so you’d need to manually source the file /etc/profile.d/ to access the Ruby installation.

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

chsh -s /bin/bash rails

Then switch to the user with: su - rails From man su

  -, -l, --login
     Provide an environment similar to what the user would expect had the user logged in directly.

For more info on the One-Click application, check out: