Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
HappyEmu opened this issue Nov 9, 2016 · 22 comments
Closed
Labels

Comments

@HappyEmu
Copy link

HappyEmu commented Nov 9, 2016

Hi

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'
end

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 Mina 1.0.2+ error "bash: bundle: command not found" Mina 1.0.2+ error "bash: bundle: command not found" when using mina console Nov 9, 2016
@d4be4st
Copy link
Member

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
Copy link

molfar commented Dec 9, 2016

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

@Xenofex
Copy link

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
Copy link

Xenofex commented Dec 15, 2016

Created #492 to address this

@molfar
Copy link

molfar commented Dec 15, 2016

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

d4be4st added a commit that referenced this issue Dec 15, 2016
@d4be4st
Copy link
Member

d4be4st commented Dec 15, 2016

You are correct @molfar

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

@bobmaerten
Copy link

bobmaerten commented Dec 22, 2016

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" ]
end

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}
  end
end

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

@molfar
Copy link

molfar commented Dec 26, 2016

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

@Xenofex
Copy link

Xenofex commented Dec 29, 2016

This is still there.

task :run_commands do
  if commands.run_default?
    invoke :environment
    commands.run(:remote)
  end
end

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
Copy link

Xenofex commented Jan 5, 2017

Happy New Year!

And... any updates on this?

@xikaos
Copy link

xikaos commented Jan 9, 2017

@Xenofex I hope so. aaf50c5

@stereodenis
Copy link
Contributor

@xikaos 1.0.6 not work's for me

@havran
Copy link

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.

@ajahongir
Copy link

having same issue

@HappyEmu
Copy link
Author

@d4be4st Could we reopen this issue? Seems like the bug still persists.

@bindiry
Copy link

bindiry commented Mar 16, 2017

I having same issue.
mina 1.0.6 with rbenv

@bobmaerten
Copy link

I gave up on mina console-ing, I just ssh to my server and bundle exec rails console now. :-/

@Martin288
Copy link

Martin288 commented Mar 30, 2017

Having same issue.

mina 1.0.6 with rvm.

Currently I just add the below codes in config/deploy.rb and it seems it successfully inject the dependence :enviroment and avoid launching the console twice mentioned by @bobmaerten.

# Fix https://github.com/mina-deploy/mina/issues/476
task :console => :environment do
end

@shvetsov
Copy link

@Martin288 or just
task console: :environment

@molfar
Copy link

molfar commented Apr 10, 2017

I think everything should work out of the box, without any manipulations

@Martin288
Copy link

@shvetsov right, you can omit the empty block.
@molfar so do I.

@ghost
Copy link

ghost commented Jul 23, 2017

Create #551 to fix this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests