遇到了奇怪的问题,需要帮助。
我在尝试在生产服务器上启动rails console,但它表现出来好像rails c命令不存在。
值得一提的是,我已经是一名4年的rails开发者,在其他大量的服务器上做这个也从没问题过。在这台服务器上,我可以使用RAILS_ENV=production操作来删除、创建、迁移、填充数据库,应用程序也能正常地在线上运行而没有任何问题。
设备:
Ubuntu 14.04(racksapce第二代performance 1服务器)
带有Passenger的Nginx(通常我使用Unicorn,在我部署的所有应用程序中都没有问题)
Ruby 2.1.5(使用rvm)
Rails 4.1.7
Postgres
Capistrano 3(使用rvm、migrations、asset-precompilation等扩展)
我尝试过:
cd进入应用程序目录:
cd /home/deployer/app_name/current
这个命令会加载.rvmrc文件并显示我所在的正确的gemset,只是为了试试运行了bundle命令。
rails c production # (which usually works no problem)
bundle exec rails c production # (sometimes have to do this on older apps that do not have the newer capistrano 3 and rvm setup)
rails c production RAILS_ENV=production # (getting desperate here)
RAILS_ENV=production rails c production # (haha, surely this won't work, but out of options)
RAILS_ENV=production bundle exec rails console
每次收到这样的通知,都说明 'rails c' 不是一个有效的命令:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
..... yada yada, shows the rest of the rails options (oddly enough does not show 'c' or 'console' as options?)
我曾经登录过数百个生产控制台,其中包括使用旧版本和新版本的Unicorn和大多数较旧版本的Passenger部署的nginx/apache。
这是我第一次收到这个消息,而且控制台似乎是唯一出现问题的地方 - 其他所有东西都运行正常!应用程序正在运行并且表现良好。
我知道首先建议的是我没有从应用程序目录运行"rails c production" - 我已经至少10次进入了正确的目录并手动加载了正确的gemset,这不是问题所在。
我无法弄清为什么在开发中它可以正常工作,但在生产中却不能。我知道以前有一个脚本目录(也许是Rails 2?)- 是否还有一个包含可能已损坏的Rails脚本命令的目录?
是否有人以前遇到过这种情况或有任何建议?
我觉得我漏掉了什么。
rails server
...)rails -v
告诉你什么?是 4.1.7 吗? - wpp