ruby-on-rails - 安装 net-ssh (3.0.2) 时出错,Bundler 无法继续

标签 ruby-on-rails ubuntu amazon-web-services nginx capistrano

我想使用 capistrano 将我的 rails 应用程序部署到 AWS,我完全按照教程进行操作。

教程如下:http://www.sitepoint.com/deploy-your-rails-app-to-aws/

但是,我的域总是显示 502 Bad Gateway nginx/1.4.6 (Ubuntu)。

事实上,每次我运行 'cap production deploy' 时,我都会收到这个错误:

SSHKit::Runner::ExecuteError: Exception while executing as deploy@(my ip add): bundle exit status: 5
bundle stdout: An error occurred while installing net-ssh (3.0.2), and Bundler cannot continue.
Make sure that `gem install net-ssh -v '3.0.2'` succeeds before bundling.
bundle stderr: Nothing written

SSHKit::Command::Failed: bundle exit status: 5
bundle stdout: An error occurred while installing net-ssh (3.0.2), and Bundler cannot continue.
Make sure that `gem install net-ssh -v '3.0.2'` succeeds before bundling.
bundle stderr: Nothing written

Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@52.25.50.168: bundle exit status: 5
bundle stdout: An error occurred while installing net-ssh (3.0.2), and Bundler cannot continue.
Make sure that `gem install net-ssh -v '3.0.2'` succeeds before bundling.
bundle stderr: Nothing written

我确定 net-ssh gem 安装已经成功(在本地和服务器端)所以我不知道是什么导致了这里的问题,希望这里有人可以帮助我。

提前致谢!

更新

我试过的:sudo apt-get install ruby​​-net-ssh

我的 ubuntu 服务器 gem 列表:

部署用户的:
*** LOCAL GEMS ***

bigdecimal (1.2.6)
bundler (1.8.4)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
jruby-pageant (1.1.1)
json (1.8.1)
minitest (5.4.3)
net-ssh (3.0.2)
pg (0.17.1)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.8)

默认服务器:
*** LOCAL GEMS ***

bigdecimal (1.2.4)
io-console (0.4.2)
jruby-pageant (1.1.1)
json (1.8.1)
minitest (4.7.5)
net-ssh (3.0.2)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
test-unit (2.1.5.0)

而且我仍然在运行上限生产部署时遇到与上述完全相同的错误。

有人救我:(

最佳答案

今天早上遇到了同样的问题,不确定我们的解决方案是否相同,但这是我修复它的方法。

我正在运行 Mint 17 (Ubuntu 14.04),它在安装 Ruby 包时得到了 Ruby 1.9.3。

首先我遇到了错误net-ssh requires Ruby version >= 2.0所以我从另一个来源安装了 Ruby 2.2,然后安装了 bundler。

即使我手动手动安装了 net-ssh 3.0.2 ,仍然会遇到与您相同的错误。

结果发现 bundler 仍然引用了一些导致问题的 Ruby 1.9.1 库路径。

为了修复它,我运行了以下命令:

sudo apt-get remove ruby ruby1.9.1 bundler
sudo apt-get autoremove # to clean up removed Ruby packages
sudo gem install bundler

然后我可以运行 bundler install并且没有错误。

希望有帮助。

关于ruby-on-rails - 安装 net-ssh (3.0.2) 时出错,Bundler 无法继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34979311/

相关文章:

ruby-on-rails - 在 SSL 模式下在 nginx 后面运行时,Omniauth 和 open_id 与 Google 损坏

ruby-on-rails - Rails 新形式 -> 无

ruby-on-rails - Rails Active Admin 如何使用 2 列(来自关联的 1 列)进行 config.sort_order

amazon-web-services - 重启后无法通过公共(public)IP访问EC2实例

python - AWS Lambda 不导入 LXML

ruby-on-rails - 使用 rbenv 和多个项目随着时间的推移维护 gems

ubuntu - 使用单个脚本文件启动两个 mochiweb 服务器

ubuntu - 在ubuntu精确上找到glib-2.0库

ubuntu - Hadoop 2.4.1 安装在 Ubuntu 14.04 上无法正常运行?节点管理器 VM 堆栈保护错误

linux - 如何从亚马逊EC2实例下载网站文件和数据库?