developer tip

gem이 설치되어 있어도 RVM Bundle Install Missing Gem Error

copycodes 2021. 1. 5. 08:13
반응형

gem이 설치되어 있어도 RVM Bundle Install Missing Gem Error


현재 Bundler gem이 설치되어 있는데도 다음과 같은 오류가 발생합니다 ($ gem list를 실행할 때 나타납니다).

ERROR: Gem bundler is not installed, run `gem install bundler` first.

RVM을 사용하고 있으며 $ PATH는 다음과 같습니다.

/Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd/bin:
/Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@global/bin:
/Users/cjstingl/.rvm/rubies/ruby-1.9.2-p290/bin:
/Users/cjstingl/.rvm/bin:
/Users/cjstingl/.bin:
/usr/local/sbin:
/usr/local/Cellar/php/5.3.6/bin:
/usr/local/share/python:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/bin:
/usr/X11/bin

또한 이것은 내 보석 환경입니다.

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.2.0]
  - INSTALLATION DIRECTORY: /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd
  - RUBY EXECUTABLE: /Users/cjstingl/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd
     - /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => false
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "-n/usr/local/bin --no-ri --no-rdoc --no-user-install"
  - REMOTE SOURCES:
     - http://rubygems.org/

또한 : bundle -v 명령을 사용하면 동일한 오류가 반환됩니다.

RVM을 파열시키고 작동하지 않는 재설치를 시도했습니다. 난 당황하고 어떤 도움을 주시면 감사하겠습니다.


다음 (.bash_profile에서 가져옴)을 .bashrc에 추가하면 문제가 해결되었습니다.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

RVM 1.10.3을 새로 설치해도 동일한 문제가 발생했습니다. 재설치 후 번 들러가 설치되어 있고 <gemset> / bin 디렉토리가 내 $ PATH에 추가되고 있지만 해당 bin 디렉토리는 실제로 존재하지 않습니다. RVM 버그 일 뿐이라고 생각합니다.

빠른 수정으로 bundle바이너리를 존재하는 RVM bin dir에 수동으로 복사했습니다 . 내 문제가 해결 된 것 같습니다.

$ cd ~/.rvm
$ cp gems/ruby-1.9.3-p0/gems/bundler-1.0.21/bin/bundle rubies/ruby-1.9.3-p0/bin/

이러한 경로의 Ruby 및 Bundler 버전은 사용자에게 다를 수 있습니다.


위의 해결책은 작동하지만 그것은 나를 괴롭 혔으므로 rvm 녀석들에게 넣었습니다. 내 ~ / .gemrc 파일이 다음 줄로 gem 위치를 재정의했습니다.

- "gem" => "-n/usr/local/bin"

그것을 제거하면 해결되었습니다. 전체 스레드는 여기를 참조하십시오 : https://github.com/wayneeseguin/rvm/issues/1043#issuecomment-7336267


비슷한 문제가 있었는데, 많은 시행 착오 끝에 답은 (적어도 저에게는) 엄청나게 간단했습니다.

이것은 확실히 경로 문제이며 @gamecreature가 경로 순서를 언급하는 것이 저에게 중요한 단서였습니다.

어떻게되었는지 잘 모르겠지만 $HOME/.rvm/binPATH 내보내기의 첫 번째 항목으로 사용했습니다.

이 디렉토리는 rvm 파일을 소싱하여 올바른 순서로 경로에 추가되므로 불필요합니다.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

그래서 내 수정은 $HOME/.rvm/bin내 PATH 내보내기에서 제거 하는 것입니다.

init 파일 (.bashrc, .bash_profile, .profile)이 여러 개인 경우 rvm 문제 해결 페이지 의 조언을 따르십시오 .

rvm 파일의 소싱이 기본적으로 PATH / 기능 또는 별칭을 사용자 정의한 후 프로필 파일 (.bash_profile / .bashrc / .zshrc)에서 마지막발생하는지 확인 합니다.

그러나 우선 순위가 될 중복 선언이 없는지 확인하기 위해 나머지 PATH 정의를 확인하는 것이 좋습니다.


비슷한 문제가있었습니다. 프로젝트 별 .rvmrc 파일이없는 것으로 밝혀졌습니다. 방금 사용하여 만들었습니다.

rvm --rvmrc --create 1.9.3@my_project_name

내 프로젝트 디렉토리에서

이것은 문제를 해결했습니다


당신이 이것의 바닥에 도달하고 여전히 벽에 머리를 두드리는 경우 ...

내 문제는 rvm install 1.8.7설치 후반에 실패했지만 성공한 것처럼 보였습니다 (루비 1.8.7이 있었고 gemset을 만들 수 있음)

그러나 $GEM_HOME설치 스크립트에서 늦게 설정된 것처럼 보이며 설정되지 않았기 때문에 rvm은 gem에 대한 올바른 위치를 찾지 못했습니다.

나는 달려서 rvm reinstall 1.8.7오류를주의 깊게 살펴 보았다.

저에게 팁을 준 것은이 스레드였습니다 : https://groups.google.com/d/topic/rubyversionmanager/aUBDxbBzZpE/discussion

실행하여 이것이 문제인지 확인할 수 있습니다.

echo $GEM_HOME또는 gem envrvm 설치 로그 확인 (위 링크 참조)

Gem Path에 루비 버전과 gemset 이름이 표시됩니까? 그렇지 않은 경우 rvm 설치가 실패했을 수 있습니다.


그것이 당신 문제의 원인인지 모르겠습니다. 하지만 비슷한 문제가있었습니다. 그 이유는 내 RVM 환경이 올바르지 않기 때문입니다.

나는 2 명의 사용자가 있었는데, 하나는 작동하지 않는 사용자였다. 작업 사용자는 다음 번들 스크립트를 사용했습니다. (출력 : 어떤 번들)

/home/rvm/.rvm/gems/ruby-1.9.3-p0/bin/bundle

잘못된 rvm-installation 사용자가 사용했습니다.

/home/user/.rvm/bin/bundle

그 이유는 잘못된 $ PATH 순서 때문입니다. .rvm / gems / ruby ​​-... / bin 경로는 ./rvm/bin 경로 앞에 있어야합니다.

내 상황에서 원인은 $ PATH 변수를 다른 사용자의 rvm으로 설정했기 때문입니다. 사용자의 RVM에 심볼릭 링크를 추가하고 경로를 다음과 같이 변경하여 문제를 해결했습니다.

/home/rvm/.rvm/bin

...에

/home/user/.rvm/bin

위의 코드가 작동하지 않으면 rvm을로드 한 직후 경로를 수동으로 조정할 수 있습니다.


이것을 시도하십시오 : https://rvm.io/integration/gnome-terminal/

시작시 실행되는 프로필에 대해 말하고 우분투 12.10을 실행 중이며 작동합니다. 터미널 프로필 기본 설정 (탭 제목 및 명령)에서 "로그인 쉘로 명령 실행"을 설정하기 만하면됩니다.

누군가에게 시간을 절약하기를 바랍니다.


이것은 새로운 빈 gemset으로 전환하고 실행 한 후에도 나에게 발생했습니다 gem install bundler. 원인은 쉘이 마지막으로 bundle사용한 실행 파일을 "기억" 하기 때문입니다. 이를 수정하려면 (적어도 bash-descendants에서) :

hash -r

이것은 분명히 PATH 변수의 문제입니다.

당신은 which bundle같은 것 /usr/local/rvm/gems/ruby-1.9.3-p194/bin/bundle대신에 같은 것을 확인해야합니다 /usr/local/rvm/bin/bundle.

힌트:

.zshrc 파일에서 PATH = some explicit list를 사용 했습니까?

그런 다음 PATH = $ PATH : some list로 변경해야합니다.


동일한 설정으로 여러 시스템에 RVM을 설치하고 한 시스템에서는 RVM에 문제가 있지만 다른 시스템에서는 이러한 문제가 발생하지 않은 후, 나는 더 좋고 오류가 적은 시스템을 찾기로 결정했습니다.

RVM보다 훨씬 단순한 rbenv찾아서 전환했습니다 .

그리고 READMErbenv는 다음 과 같이 말합니다.

rbenv는…

  • 사용자별로 글로벌 Ruby 버전변경할있습니다 .
  • 프로젝트 별 Ruby 버전에 대한 지원을 제공합니다 .
  • 환경 변수로 Ruby 버전재정의 할 수 있습니다 .

rvm과 달리 rbenv는 그렇지 않습니다.

  • 셸에로드해야합니다. 대신 rbenv의 shim 접근 방식은 $ PATH에 디렉토리를 추가하여 작동합니다.
  • cd와 같은 쉘 명령을 대체하십시오. 위험하고 오류가 발생하기 쉽습니다.
  • 구성 파일이 있습니다. 사용하려는 Ruby 버전 외에는 구성 할 사항이 없습니다.
  • Ruby를 설치합니다. Ruby를 직접 빌드하고 설치하거나 ruby-build사용 하여 프로세스를 자동화 할 수 있습니다.
  • gemset을 관리합니다. Bundler 는 애플리케이션 종속성을 관리하는 더 좋은 방법입니다. 아직 Bundler를 사용하지 않는 프로젝트가있는 경우 rbenv-gemset 플러그인을 설치할 수 있습니다 .
  • 호환성을 위해 Ruby 라이브러리를 변경해야합니다. rbenv의 단순성은 $ PATH에있는 한 다른 어떤 것도 알 필요가 없다는 것을 의미 합니다.
  • Prompt you with warnings when you switch to a project. Instead of executing arbitrary code, rbenv reads just the version name from each project. There's nothing to "trust."

So if you ask me, dump RVM and switch to rbenv.


I installed ruby 1.9.3 by rvm. After git octopress completed, just edit $path_of_git/.rvmrc like this "rvm use 1.9.3". AND THEN run command of "cd ..; cd $path_of_git". After that it will ask you weather trust the .rvmrc or not. Type 'y' to make .rvmrc file work.


I had a very similar problem for a slightly different reason. My home directory had a .gemrc file left over from an old ruby setup, and I'd missed when deleting the old files. It seems that gem was confusing the rvm settings with the settings in this file. Once I removed it (and some files installed to the old location), everything worked fine.


I ran into the same problem earlier today. The approach I used to resolve the issue was this:

1) Run

cap shell

on the same machine you would normally run cap deploy. Then execute

env | sort

This runs the command on the remote server. Copy and paste the output into a local text file, e.g. capenv.txt

2) SSH into the same remote server, and do the same command, namely env | sort. Save this locally as a text file, e.g. sshenv.txt

3) Diff the two files and see what is in sshenv.txt that is not in capenv.txt - this is most likely where your problem lies.

< ++CAP ++
< _=/bin/sh
---
> ++ SSH ++
> __array_start=0
14a15
> PS1=\[\e]2;tracker@charlotte\a\e[0;31m LIVE:\u@\h \w> \e[0m
18d18
< rvm_env_string=ruby-1.9.3-p194
21d20
< rvm_ruby_string=ruby-1.9.3-p194
27c26,28
< USER=tracker
\ No newline at end of file
---
> USER=tracker
> USES_BASHRC=bashrc
> _=/usr/bin/env

4) I immediately noticed that the shell interpreter was not set to bash. This can be fixed by adding

set :shell, '/usr/bin/bash'

to your deploy.rb file. This resolved my problem


This works for me when I specify the version of Ruby I want to use:

$ rvm use 1.9.2-p290
Using /Users/myname/.rvm/gems/ruby-1.9.2-p290

Ran into this problem myself after updating my Ruby patch level. I ran which gem and discovered that it was using a global version of rubygems, in this case the path was ~/.rvm/bin/gem. So I ran rvm rubygems current, which installed it in ~/.rvm/rubies/ruby-1.8.7-p370/bin/gem. Ran gem install bundler and bundle again. Problem solved.


I had the same issue when I had an empty .rvmrc file in the directory I switched to (rvm 1.15.1). Obviously there are lots of causes for this error


Ran into the same issue (where I kept on installing the bundler and rvm won't recognize it) on one of my laptops. I guessed I might have installed RVM wrong while I was still a rails noob. I tried the solution above but it didn't work for me. After messing around with it, I gave up and removed RVM and reinstall it. I figured it was due to some weird configuration issue deeply nested somewhere or . Here are the steps I took:

Remove RVM:

rvm implode

Install RVM again:

curl -L https://get.rvm.io | bash -s stable --rails
rvm reload

Since I am working on an old rails project for work, I had to install ree-1.8.7-2012.02

rvm install ree-1.8.7-2012.02

Of course, Murphy's Law still applies. I ran into another issue where my laptop could not find a Non-broken C compiler even though Xcode is installed along with gcc. My final steps were going to https://github.com/kennethreitz/osx-gcc-installer and install their package and reinstalling ree.

I hope this last resort solution helps someone. Good luck!


For my setup, adding the user that apache runs as to the rvm group worked

usermod -a -G rvm www-data

I had this problem, too. I fixed my issue by specifying a gemset.

$ bundle install
ERROR: Gem bundler is not installed, run `gem install bundler` first.

$ rvm gemdir
/usr/local/rvm/gems/ruby-1.9.3-p194

$ rvm gemset list

gemsets for ruby-1.9.3-p194 (found in /usr/local/rvm/gems/ruby-1.9.3-p194)
   global
   rails32

$ rvm gemset use rails32

Using ruby-1.9.3-p194 with gemset rails32

$ rails s

Could not find rake-10.0.4 in any of the sources

Run `bundle install` to install missing gems.

$ bundle install

Fetching gem metadata from https://rubygems.org/.......
{And voila! it worked!}

ReferenceURL : https://stackoverflow.com/questions/8990828/rvm-bundle-install-missing-gem-error-even-though-gem-is-installed

반응형