로드 할 파일이 없습니다 — rubygems (LoadError)
최근에 페도라 12에 레일을 설치했습니다. 리눅스도 처음 사용합니다. Windows 7에서는 모든 것이 잘 작동하지만 Linux에서는 많은 문제에 직면 해 있습니다. 도와주세요!
기본 스크립트 / 서버를 시작하고 실행하는 데 필요한 모든 요소를 설치했습니다. 스크립트 / 서버를 시도 할 때 boot.rb에서이 오류가 나타납니다. 여기에 제공하고 싶은 세부 정보 중 일부는 다음과 같습니다.
rails, ruby, gem이 설치된 디렉토리,
[vineeth@localhost my_app]$ which ruby
/usr/local/bin/ruby
[vineeth@localhost my_app]$ which rails
/usr/bin/rails
[vineeth@localhost my_app]$ which gem
/usr/bin/gem
그리고 스크립트 / 서버를 실행할 때 이것이 오류입니다.
[vineeth@localhost my_app]$ script/server
./script/../config/boot.rb:9:in `require': no such file to load -- rubygems (LoadError)
from ./script/../config/boot.rb:9
from script/server:2:in `require'
from script/server:2
그리고 PATH 파일은 다음과 같습니다.
[vineeth@localhost my_app]$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin/ruby:$PATH"
PATH 파일과 관련이 있다고 생각합니다. 여기에서 변경해야 할 사항을 알려주세요. 다른 변경 사항이 있으면 알려주십시오.
두 개의 루비 버전이 있다는 직감이 있습니다. 다음 명령의 출력을 붙여 넣으십시오.
$ which -a ruby
댓글에 대한 업데이트 :
하나의 버전을 Nuke하고 하나만 남겨 둡니다. 나는 보석의 다른 위치를 보는 두 가지 버전에서 동일한 문제가 발생했습니다. 내가 몇 주 동안 미쳐 버렸습니다. 여기에 현상금을 올리면 내가 당신에게 줄 것과 같은 대답을 얻었습니다.
내가 한 것은 루비 하나를 설치하고 포트를 통해 관리 할 수 있도록 남겨 두는 것뿐이었습니다. 이렇게하는 것이 좋습니다.
- 포트 (yum 또는 다른 패키지 관리자)를 통해 설치된 루비 버전을 제거합니다.
- OS와 함께 제공된 루비 버전을 제거합니다 (하드 코어 rm 손으로).
- 접두사가 다른 포트에서 루비 버전 설치 (
/usr대신/usr/local) - 재설치
rubygems
루비의 여러 복사본이 설치되어 있기 때문에 Ubuntu에서 비슷한 문제가 발생했습니다. (1.8 및 1.9.1) 불행히도 둘 다 필요합니다. 해결책은 다음을 사용하는 것입니다.
$ sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
그 후에 번들 설치가 성공했습니다.
좋아, 나는 Ruby 멍청한 사람이지만 여기의 답변과 약간 다르게 수정되었으므로 다른 사람에게 도움이되기를 바랍니다 (tl; dr : RVM을 사용하여 시스템 Ruby 버전을 rubygems에서 예상하는 것과 동일한 버전으로 전환했습니다).
먼저, Eimantas 가 언급 한 모든 루비를 나열 하는 것이 좋은 출발점이었습니다.
> which -a ruby
/opt/local/bin/ruby
/Users/Brian/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/Brian/.rvm/bin/ruby
/usr/bin/ruby
/opt/local/bin/ruby
시스템에서 사용중인 기본 Ruby 인스턴스는 1.8.7 인 것으로 보입니다.
> ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10]
Rubygems에서 사용중인 버전은 RVM에서 관리하는 1.9.2 버전입니다.
> gem env | grep 'RUBY EXECUTABLE'
- RUBY EXECUTABLE: /Users/Brian/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
그래서 그것은 확실히 문제였습니다. 저는 Ruby를 직접 사용하지 않습니다 (이는 단순히 실행하려는 빌드 시스템 스크립트의 종속성입니다). 따라서 어떤 버전이 다른 용도로 활성화되었는지는 신경 쓰지 않았습니다. rubygems는 이미 RVM에서 관리하는 1.9.2를 예상했기 때문에 RVM을 사용하여 1.9.2 버전을 기본값으로 사용하도록 시스템을 전환했습니다.
> rvm use 1.9.2
Using /Users/Brian/.rvm/gems/ruby-1.9.2-p290
> ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.3.0]
After doing that my "no such file" issue went away and my script started working.
I would just like to add that in my case rubygems wasn't installed.
Running sudo apt-get install rubygems solved the issue!
Try starting the project with:
./script/server
instead of script/server if you are using ruby 1.9.2 (from strange inability to require config/boot after upgrading to ruby 1.9.2)
In case anyone else is googling this problem: I was able to fix mine by finding the elusive "rubygems" folder that I wanted to use and adding it to my $RUBYLIB environment variable.
find / -name "rubygems" -print
Once you find it, add the parent directory to your environment. In bash, like so:
export RUBYLIB=/path/to/parent
Now if you run gem, it should pick up the right library directory, and you're off and running.
I had a similar problem, simply running a trivial ruby script that just required the gem i wanted...got that error message. When I changed the incantation from:
ruby test.rb
to
ruby -rubygems test.rb
Seemed to work.
I had a similar problem and solved that by setting up RUBYLIB env.
In my environment I used this:
export RUBYLIB=$ruby_dir/lib/ruby/1.9.1/:$ruby_dir/lib/ruby/1.9.1/i686-linux/:$RUBYLIB
If you have several ruby installed, it might be sufficient just to remove one of them, on MacosX with extra ports install, remove the ports ruby installation with:
sudo port -f uninstall ruby
I also had this issue. My solution is remove file Gemfile.lock, and install gems again: bundle install
gem install bundler
fixed the issue for me.
This is the first answer when Googling 'require': cannot load such file -- ubygems (LoadError) after Google autocorrected "ubygems" to "rubygems". Turns out this was an intentional change between Ruby 2.4 and 2.5 (Bug #14322). Scripts that detect the user gems directory without taking into account the ruby version will most likely fail.
Ruby 2.4
ruby -rubygems -e 'puts Gem.user_dir'
Ruby 2.5
ruby -rrubygems -e 'puts Gem.user_dir'
I have also met the same problem using rbenv + passenger + nginx. my solution is simply adding these 2 line of code to your nginx config:
passenger_default_user root;
passenger_default_group root;
the detailed answer is here: https://stackoverflow.com/a/15777738/445908
Simply running /bin/bash --login did the trick for me, weirdly. Can't explain it.
참고URL : https://stackoverflow.com/questions/2896485/no-such-file-to-load-rubygems-loaderror
'IT TIP' 카테고리의 다른 글
| Android에서 파일에 대한 MD5 체크섬을 생성하는 방법은 무엇입니까? (0) | 2020.11.25 |
|---|---|
| Swift에서 UIButton 및 UILabel의 텍스트를 어떻게 회전 할 수 있습니까? (0) | 2020.11.25 |
| 어쨌든 사전을 String으로 편리하게 변환하는 것이 있습니까? (0) | 2020.11.25 |
| EditText에서 키보드 비활성화 (0) | 2020.11.25 |
| 텍스트 입력의 내부 그림자 제거 (0) | 2020.11.25 |