当我在Capistrano部署的bundle exec rails console production
文件夹中的服务器上通过SSH运行rails console production
或Current
时,我得到:
Usage:
rails new APP_PATH [options]
Options:
(...)
解释开始一个新的应用程序。在当地它的工作原理。为什么我不能远程启动控制台?
我假设您从版本3更新到rails 4
,您的应用程序无法在bin
目录中找到可执行文件。运行此命令以查看您的rails版本:
$ rails -v
如果你的rails
版本是4或更高,请尝试运行:
$ rake rails:update:bin
6.1 Notable changes
- 您的应用程序的可执行文件现在位于
bin/
目录中。运行rake rails:update:bin
获得bin/bundle
,bin/rails
和bin/rake
。
我正在使用capistrano进行部署,包括capistrano / bundler gem。由于./bin
目录在Rails 4中受版本控制,我们需要阻止Capistrano通过从set :linked_dirs
中删除bin来在部署中链接它。
现在为了防止bundler覆盖版本控制的binstub,我们可以添加行set :bundle_binstubs, nil
,这将阻止capistrano-bundler在运行bundle install时设置--binstubs选项。
我的config / deploy.rb文件现在有这些行:
# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
set :bundle_binstubs, nil
请注意bin
行中缺少:linked_dirs
目录。
我有同样的问题,当你通过cap shared/bin
进行部署是qmlxswpoi的符号链接时结果。
这对我有用:
current/bin
rm current/bin
mkdir current/bin
这应该有所帮助,但它有点暂时的解决方案,我试图找出如何使cap不自动符号化current / bin。
如果是Rails 5.2
我不得不通过在项目根目录中运行以下命令来删除bin目录。
rake rails:update:bin
然后我在项目根目录中运行另一个命令:
rm -rf bin
它会显示如下输出:
rake app:update:bin
而已。
这已经有一段时间了,因为这得到了解答。
在我的情况下,我需要运行:
create bin
create bin/bundle
create bin/rails
create bin/rake
create bin/setup
create bin/update
create bin/yarn
注意 - app而不是rails。
我在Rails 5.1应用程序中全部缺少bin目录