Mina 1.0.2+ error "bash: bundle: command not found" when using `mina console` #476

HappyEmu opened this Issue Nov 9, 2016 · 13 comments


None yet

8 participants

HappyEmu commented Nov 9, 2016 edited


I am using Mina version 1.0.3 in a Rails project. When I try to connect to the production console using mina console I get the following error: bash: bundle: command not found. I'm using rbenv on the server where the app is deployed, the :environment task looks as follows:

task :environment do
  invoke :'rbenv:load'

While mina ssh, mina log and mina deploy work flawlessly, mina console, mina rake and the likes all produce the above mentioned error.

Am I doing something wrong or is this a bug?

@HappyEmu HappyEmu changed the title from Mina 1.0.2+ error "bash: bundle: command not found" to Mina 1.0.2+ error "bash: bundle: command not found" when using `mina console` Nov 9, 2016
d4be4st commented Nov 16, 2016

I managed to reproduce it.

Have a logical error in my code. Will try to fix it.

@d4be4st d4be4st added the bug label Nov 16, 2016
molfar commented Dec 9, 2016 edited

@d4be4st so how to deal with this error? I looks like in all these tasks the environment task is not invoked.

Xenofex commented Dec 14, 2016

Encountered the same error here. mina console used to depend on the environment task back in 0.3.8, but not anymore in 1.0.3. It definitely should depend on the 'environment' task.

Xenofex commented Dec 15, 2016

Created #492 to address this

@d4be4st d4be4st added a commit that closed this issue Dec 15, 2016
@d4be4st d4be4st Fix #476 da87ec8
@d4be4st d4be4st closed this in da87ec8 Dec 15, 2016
molfar commented Dec 15, 2016

Is it ok that environment would be invoked twice, in Mina::DSL.run and in run_commands task?

@d4be4st d4be4st added a commit that referenced this issue Dec 15, 2016
@d4be4st d4be4st Really fix #476 aaf50c5
d4be4st commented Dec 15, 2016

You are correct @molfar

Need to add some specs to this but #aaf50c5 should fix this

bobmaerten commented Dec 22, 2016 edited

That does not seems to fix (for me at least). I use rbenv and my gems shims are not anywhere in my $PATH, so I have to force it in :environment task

task :environment do
  invoke 'rbenv:load'
  command %[ export PATH="$PATH:$HOME/.rbenv/shims" ]

if I override default console task by prepending environment load, my rails console task works:

task console: :environment do
  set :execution_mode, :exec
  in_path fetch(:current_path).to_s do
    command %{#{fetch(:rails)} console}

But when I quit the console, another one is launched... o_O

molfar commented Dec 26, 2016 edited

Mina 1.0.6 with rbenv still not working...
bash: bundle: command not found
It looks like bug is not really fixed yet

Xenofex commented Dec 29, 2016 edited

This is still there.

task :run_commands do
  if commands.run_default?
    invoke :environment

It appears that commands.run(:remote) happens before invoke :environment. I'm still figuring out why.

UPDATE: now I get what this means and why this is wrong:

The invoke here: put this task in the queue
The :run_commands task: comes after everything else.

Therefore this is merely appending the :environment tasks after everything else, which is, too late.

Xenofex commented Jan 5, 2017

Happy New Year!

And... any updates on this?

xikaos commented Jan 9, 2017

@Xenofex I hope so. aaf50c5


@xikaos 1.0.6 not work's for me

havran commented Jan 11, 2017

Hi. I have same problem on my vagrant Ubuntu machine ().

vagrant@vagrant-ubuntu-uidis:/data/form-builder-rails-mina$ mina -V
Mina, version v1.0.6
vagrant@vagrant-ubuntu-uidis:/data/form-builder-rails-mina$ mina console
vagrant@localhost's password:
bundler: command not found: rails
Install missing gem executables with `bundle install`
-----> Loading rbenv
Connection to localhost closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment