简体   繁体   English

捆绑安装 - Ubuntu上的Rails

[英]Bundle Install - Rails on Ubuntu

I have a problem with bundle install on production server. 我在生产服务器上安装捆绑包时遇到问题。 I have a fresh Droplet at DigitalOcean running Rails and Ubuntu 14.02. 我在DigitalOcean运行Rails和Ubuntu 14.02时有一个新的Droplet。 If I run as root: 如果我以root身份运行:

bundle install

I get the following message and my application breaks, start getting "Bad Gateway" errors from Nginx: 我得到以下消息,我的应用程序中断,从Nginx开始收到“Bad Gateway”错误:

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: 如果我作为rails用户运行bundle install:

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, 谢谢你的帮助,

Looks like the Bundler gem is installed for root user but not the rails user. 看起来像为root用户安装了Bundler gem,但没有为rails用户安装。

  1. If you are not using a ruby version manager such as rbenv or rvm, do: gem install bundler . 如果您没有使用rubben版本管理器,例如rbenv或rvm,请执行: gem install bundler

  2. If you have a ruby version manager, your rails user doesn't have access to it because you installed it for 1 user only. 如果您有ruby版本管理器,则rails用户无权访问它,因为您仅为1位用户安装了它。 In this case, your problem is more than not being able to run bundler. 在这种情况下,您的问题不仅仅是无法运行bundler。 You might not have rails or even ruby installed at all for that user. 您可能根本没有为该用户安装rails或ruby。

The ruby installation on the Rail on Rails One-Click application is managed by RVM. Rail on Rails One-Click应用程序上的ruby安装由RVM管理。 If you run which bundle you can see that the binary is installed to: 如果您运行哪个捆绑包,则可以看到二进制文件已安装到:

which bundle 捆绑

/usr/local/rvm/gems/ruby-2.1.3/bin/bundle The rails user doesn't have a login shell, so you'd need to manually source the file /etc/profile.d/rvm.sh to access the Ruby installation. /usr/local/rvm/gems/ruby-2.1.3/bin/bundle rails用户没有登录shell,因此您需要手动将文件/etc/profile.d/rvm.sh发送到访问Ruby安装。

You can set a proper login shell for the rails user by running: 您可以通过运行以下命令为rails用户设置正确的登录shell:

chsh -s /bin/bash rails chsh -s / bin / bash rails

This worked for me and it should also work for you. 这对我有用,它也应该适合你。 Thanks 谢谢

I had this issue today,when i deploy my web app on vps. 我今天遇到这个问题,当我在vps上部署我的网络应用程序时。

the ruby version manages is RVM, ruby版本管理的是RVM,

i try to install new ruby version 2.2.2,but the problem had appear 我尝试安装新的ruby版本2.2.2,但问题出现了

then try install new bundler version, the machine bundler is latest 1.12.3 然后尝试安装新的捆绑版本,机器捆绑器是最新的1.12.3

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

the issue has to solve 问题必须解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM