<p>mina deploy 抛出错误 - 捆绑:找不到命令! 错误:部署失败。</p>

创建于 2017-11-28  ·  6评论  ·  资料来源: mina-deploy/mina

mina 部署抛出错误。 任何帮助将非常感激。

这是mina deploy --trace

root@ruby-rails-1gb-blr1-01:/home/rails/rails-demo# mina deploy --trace
** Invoke deploy (first_time)
** Execute deploy
** Invoke remote_environment (first_time)
** Execute remote_environment
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
** Invoke puma:phased_restart (first_time)
** Invoke remote_environment (first_time)
** Execute remote_environment
** Execute puma:phased_restart
[email protected]'s password: 
-----> Creating a temporary build path
-----> Deploying rails-demo to 139.59.72.156:/home/rails/rails-demo
-----> Fetching new git commits
       remote: Counting objects: 43, done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 43 (delta 6), reused 43 (delta 6), pack-reused 0
Unpacking objects: 100% (43/43), done.   
       From github.com:krishnateja/rails-demo
          739096a..4cf74f8  master     -> master
-----> Using git branch 'master'
       Cloning into '.'...
       done.
-----> Using this git commit
       root (4cf74f8):
       > small config change
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
       bash: line 137: bundle: command not found
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK
       Connection to 139.59.72.156 closed.

 !     Run Error

部署文件

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'

set :application_name, 'rails-demo'
set :domain, '139.59.72.156'
set :deploy_to, '/home/rails/rails-demo'
set :repository, '[email protected]:krishnateja/rails-demo.git'

set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/pids', 'tmp/sockets', 'public/uploads')
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml', 'config/puma.rb')
set :user, 'root'

task :environment do
  invoke :'rvm:use', 'ruby-2.2.3'
end

task :setup do
  command %[touch "#{fetch(:shared_path)}/config/database.yml"]
  command %[touch "#{fetch(:shared_path)}/config/secrets.yml"]
  command %[touch "#{fetch(:shared_path)}/config/puma.rb"]
  comment "Be sure to edit '#{fetch(:shared_path)}/config/database.yml', 'secrets.yml' and puma.rb."
end

task :deploy do
  deploy do
    comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}"
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      invoke :'puma:phased_restart'
    end
  end

end

美洲狮

environment "production"

bind  "unix:///home/rails/rails-demo/shared/tmp/sockets/puma.sock"
pidfile "/home/rails/rails-demo/shared/tmp/pids/puma.pid"
state_path "/home/rails/rails-demo/shared/tmp/sockets/puma.state"
directory "/home/rails/rails-demo/current"

workers 2
threads 1,2

daemonize true

activate_control_app 'unix:///home/rails/rails-demo/shared/tmp/sockets/pumactl.sock'

prune_bundler

最有用的评论

如果您使用:environment块,请将其重命名为:remote_environment以定位远程服务器,或运行mina init以复制新的部署脚本(备份旧的deploy.rb优先)。 这也发生在我身上,尽管使用 rbenv 而不是 rvm。

所有6条评论

更新我的 gemfile 后,我遇到了同样的问题

尝试运行 sudo gem install ruby​​-bundler。

那应该可以解决问题。

上周五,2017年12月8日,zhangmingchang [email protected]
写道:

更新我的 gemfile 后,我遇到了同样的问题


您收到此消息是因为您创作了该线程。
直接回复本邮件,在GitHub上查看
https://github.com/mina-deploy/mina/issues/594#issuecomment-350198303
或静音线程
https://github.com/notifications/unsubscribe-auth/AAeZsg2vTdUuBcHdfXCugGXTBZFkHpuXks5s-OwQgaJpZM4QtZ6B
.

试试bundle exec mina deploy
这解决了我的问题。

当谈到“未找到命令:捆绑”错误时,主要原因是人们没有在他们的服务器上为该特定版本的 ruby​​ 安装它。 如果您正在使用 Rbenv、Rvm... 只需切换到该确切版本并运行gem install bundler
我正在使用 Rbenv,所以每当我想部署一个将使用新版本 ruby​​(我还没有安装)的应用程序时,我 ssh 到我的服务器并运行

rbenv install 2.5.0
rbenv shell 2.5.0
gem install bundler

看看常见问题

如果您使用:environment块,请将其重命名为:remote_environment以定位远程服务器,或运行mina init以复制新的部署脚本(备份旧的deploy.rb优先)。 这也发生在我身上,尽管使用 rbenv 而不是 rvm。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

ghost picture ghost  ·  12评论

davidhq picture davidhq  ·  10评论

syamilmj picture syamilmj  ·  11评论

jakoss picture jakoss  ·  3评论

hlcfan picture hlcfan  ·  8评论