由于红宝石消息导致Capistrano部署失败

时间:2016-02-16 20:25:45

标签: ruby-on-rails ruby deployment capistrano sprockets

我正在尝试使用capistrano 3.4.0&部署我的应用程序capistrano-rails 1.1.6但似乎在资产清单期间,当复制.sprockets-manifest.json的命令运行时,不知何故ruby消息与commandos混合并导致部署失败。

之前发生这种情况,我可以通过将sprockets gem降级到版本2.8来修复它,但是在这里我使用的是rails 4.2.4并且它需要至少3个链轮版本。

下面是命令和输出,如果你能帮助我,我会很高兴。

提前致谢

INFO [19795580] Running /usr/bin/env cp RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,  you can ignore these warnings with 'rvm rvmrc warning ignore /var/www/apps/meetings/releases/20160216200613/Gemfile'.  To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.    /var/www/apps/meetings/releases/20160216200613/public/assets/.sprockets-manifest-5435a7146eb18edb8a835b87bffff57b.json /var/www/apps/meetings/releases/20160216200613/assets_manifest_backup as user@server
DEBUG [19795580] Command: cd /var/www/apps/meetings/releases/20160216200613 && /usr/bin/env cp RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,  you can ignore these warnings with 'rvm rvmrc warning ignore /var/www/apps/meetings/releases/20160216200613/Gemfile'.  To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.    /var/www/apps/meetings/releases/20160216200613/public/assets/.sprockets-manifest-5435a7146eb18edb8a835b87bffff57b.json /var/www/apps/meetings/releases/20160216200613/assets_manifest_backup
DEBUG [19795580]    RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /var/www/apps/meetings/releases/20160216200613/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

DEBUG [19795580]    cp: cannot stat ‘RVM’: No such file or directory
cp: cannot stat ‘used’: No such file or directory
cp: cannot stat ‘your’: No such file or directory
cp: cannot stat ‘for’: No such file or directory
cp: cannot stat ‘selecting’: No such file or directory
cp: cannot stat ‘Ruby,’: No such file or directory
cp: cannot stat ‘it’: No such file or directory
cp: cannot stat ‘is’: No such file or directory
cp: cannot stat ‘all’: No such file or directory
cp: cannot stat ‘fine’: No such file or directory
cp: cannot stat ‘-’: No such file or directory
cp: cannot stat ‘Heroku’: No such file or directory
cp: cannot stat ‘does’: No such file or directory
cp: cannot stat ‘that’: No such file or directory
...
...

2 个答案:

答案 0 :(得分:2)

行。问题是因为rvm覆盖了cd命令以便在Gemfile中提供有关ruby版本控制的一些信息,并且当capistrano-rails运行清单备份任务时,它运行cd命令以进入app项目文件夹和rvm信息也正在返回,部署因此引起了错误。

要解决这个问题,要么

rvm rvmrc warning ignore allGemfiles
可以运行

并且可以在服务器范围内禁用rvm消息,也可以在项目的根路径中创建名为.ruby-version的文件,并在其中设置ruby版本。例如:

2.2.4

据我所知.ruby-version用于rbenv但不知何故它也禁用了rvm消息。

希望它也可以帮助其他人

答案 1 :(得分:0)

Rails 4+对某些宝石的特定版本非常挑剔。尝试将gemfile更新为以下内容:

group :development, :test do
  gem 'capistrano', '~> 3.4.0'
  gem 'capistrano-rvm'
  gem 'capistrano-bundler', '~> 1.1.2'
  gem 'capistrano-rails', '~> 1.1'
  gem 'capistrano-passenger'
end