Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundler can't seem to find correct Ruby through Rbenv

For years I used RVM as my Ruby version manager, but I want to switch to rbenv for its simplicity. However I'm finding some strange problems deploying. Here's where it seems to go wrong:

# env RBENV_ROOT=\"/home/deploy/.rbenv\" PATH=\"/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH\"  /home/deploy/.rbenv/bin/rbenv exec bundle install --gemfile /domains/myapp.com/releases/20140119013611/Gemfile --path /domains/myapp.com/shared/bundle --deployment --without development test

> rbenv: bundle: command not found

> The `bundle' command exists in these Ruby versions:
> 2.0.0-p353

Okay, so I specify the rbenv version I want --

# env RBENV_ROOT=\"/home/deploy/.rbenv\" PATH=\"/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH\" RBENV_VERSION=\"2.0.0-p353\" /home/deploy/.rbenv/bin/rbenv exec bundle install --gemfile /domains/myapp.com/releases/20140119013611/Gemfile --path /domains/myapp.com/shared/bundle --deployment --without development test
> rbenv: version `"2.0.0-p353"' is not installed

Huh. That's weird.

# rbenv versions
> system
> * 2.0.0-p353 (set by /home/deploy/.rbenv/version)

Any idea where I'm going wrong? The bundle install command appears to think that 2.0.0-p353 is absent, but rbenv versions shows it. What might be up?

like image 826
isthmuses Avatar asked Jan 19 '14 01:01

isthmuses


2 Answers

install the bundler tool: gem install bundler.

install the dependancies of the project: bundle install

like image 83
Sartaj Singh Sisodiya Avatar answered Sep 30 '22 19:09

Sartaj Singh Sisodiya


I believe it's an escaping problem.

I can set the current ruby version like this successfully:

rbenv local 2.0.0-p247

or this:

rbenv local "2.0.0-p247"

But if I escape the quotes, I get an error exactly like you get (notice the quotes in the error response):

> rbenv local \"2.0.0-p247\"
rbenv: version `"2.0.0-p247"' not installed

Note that usually quotes are not around a a bogus version:

> rbenv local 2.0.0-p111
rbenv: version `2.0.0-p111`

So, in conclusion, I'm guessing that the bundler-less system ruby is invoked in your first snippet, and you haven't yet seen a successful attempt to try bundle with the rbenv managed version due to the RBENV_VERSION quoting issue.

like image 37
sethcall Avatar answered Sep 30 '22 19:09

sethcall