使用明确版本的ruby以root身份安装没有rvm的Gems

时间:2021-05-18 23:22:21

I've decided to get rid of rvm, and I'm having trouble compiling a gem with my new version of ruby 1.9.2. The gem requires 1.9.2, I have it, yet says it can't install without, so the error messages makes no sense.

我已经决定摆脱rvm,而我在使用新版本的ruby 1.9.2编译gem时遇到了麻烦。宝石需要1.9.2,我有它,但说不能没有安装,所以错误信息没有意义。

How can I explicitly tell the gem to compile with said version of ruby?

如何明确告诉gem使用所述版本的ruby进行编译?

Gem::InstallError: linecache19 requires Ruby version >= 1.9.2.
An error occured while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.
 apps2 ~/projects/sms/apps2/apps2_admin $ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
 apps2 ~/projects/sms/apps2/apps2_admin $ which ruby
/usr/local/bin/ruby

3 个解决方案

#1


2  

I had the same issue (linecache19 hangs forever/indefinitely) when using rbenv on OS X Lion. I found the solution was to install Ruby with OpenSSL option, like this:

在OS X Lion上使用rbenv时,我遇到了同样的问题(linecache19永远/无限期挂起)。我发现解决方案是使用OpenSSL选项安装Ruby,如下所示:

rbenv install 1.9.2-p290 --with-openssl-dir=/usr/local
rbenv rehash
rbenv global 1.9.2-p290

Now, you can run or bundle this and it'll install fine:

现在,您可以运行或捆绑它,它将安装正常:

gem install ruby-debug19

Hope that helps someone.

希望能帮助别人。

#2


7  

I had a similar issue and traced back the issue and solved it as follows:

我遇到了类似的问题并追溯了问题并解决了如下问题:

The root of the issue is that in the gem installer.rb file the passed required ruby version from linecache19 is 1.9.2 while the Gem.ruby_version is something like 1.9.2.dev.30909, and ("1.9.2" >= "1.9.2.dev.30909") is false.

问题的根源是在gem installer.rb文件中,linecache19传递的所需ruby版本是1.9.2,而Gem.ruby_version类似于1.9.2.dev.30909,(“1.9.2”> = “1.9.2.dev.30909”)是假的。

so first become sure that ruby version is 1.9.2:

所以首先要确保ruby版本是1.9.2:

ruby -v

then manually use --force to bypass version check:

然后手动使用--force绕过版本检查:

gem install ruby_core_source
gem install linecache19 --force

if you faced with another error starting with following lines:

如果您遇到以下行开头的另一个错误:

checking for vm_core.h... no
*** extconf.rb failed ***

You have to explicitly set the source path to vm_core.h

您必须显式设置vm_core.h的源路径

In my case:

就我而言:

$ which ruby
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby
$ echo $rvm_path
/Users/Reza/.rvm/

so to install linecache19 :

所以要安装linecache19:

gem install ruby_core_source
gem install linecache19 --force -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-rc2/

ruby-debug19 has a similar issue:

ruby-debug19有一个类似的问题:

gem install ruby-debug19 --force -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-rc2/

That's all!

#3


0  

This is what worked on Ubuntu:

这是在Ubuntu上工作的:

I had the same problems and tried so many options before I came across this: http://beginrescueend.com/packages/openssl/

在遇到这个问题之前,我遇到了同样的问题并尝试了很多选项:http://beginrescueend.com/packages/openssl/

$ rvm pkg install openssl
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-openssl-dir=$rvm_path/usr

This resolves the issue with linecache19 rubydebug-19 and openssl:

这解决了linecache19 ruby​​debug-19和openssl的问题:

*** extconf.rb failed ***
custom_require.rb:36:in `require': no such file to load -- openssl (LoadError)

then you can do

那么你可以做到

gem install ruby-debug19

#1


2  

I had the same issue (linecache19 hangs forever/indefinitely) when using rbenv on OS X Lion. I found the solution was to install Ruby with OpenSSL option, like this:

在OS X Lion上使用rbenv时,我遇到了同样的问题(linecache19永远/无限期挂起)。我发现解决方案是使用OpenSSL选项安装Ruby,如下所示:

rbenv install 1.9.2-p290 --with-openssl-dir=/usr/local
rbenv rehash
rbenv global 1.9.2-p290

Now, you can run or bundle this and it'll install fine:

现在,您可以运行或捆绑它,它将安装正常:

gem install ruby-debug19

Hope that helps someone.

希望能帮助别人。

#2


7  

I had a similar issue and traced back the issue and solved it as follows:

我遇到了类似的问题并追溯了问题并解决了如下问题:

The root of the issue is that in the gem installer.rb file the passed required ruby version from linecache19 is 1.9.2 while the Gem.ruby_version is something like 1.9.2.dev.30909, and ("1.9.2" >= "1.9.2.dev.30909") is false.

问题的根源是在gem installer.rb文件中,linecache19传递的所需ruby版本是1.9.2,而Gem.ruby_version类似于1.9.2.dev.30909,(“1.9.2”> = “1.9.2.dev.30909”)是假的。

so first become sure that ruby version is 1.9.2:

所以首先要确保ruby版本是1.9.2:

ruby -v

then manually use --force to bypass version check:

然后手动使用--force绕过版本检查:

gem install ruby_core_source
gem install linecache19 --force

if you faced with another error starting with following lines:

如果您遇到以下行开头的另一个错误:

checking for vm_core.h... no
*** extconf.rb failed ***

You have to explicitly set the source path to vm_core.h

您必须显式设置vm_core.h的源路径

In my case:

就我而言:

$ which ruby
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby
$ echo $rvm_path
/Users/Reza/.rvm/

so to install linecache19 :

所以要安装linecache19:

gem install ruby_core_source
gem install linecache19 --force -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-rc2/

ruby-debug19 has a similar issue:

ruby-debug19有一个类似的问题:

gem install ruby-debug19 --force -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-rc2/

That's all!

#3


0  

This is what worked on Ubuntu:

这是在Ubuntu上工作的:

I had the same problems and tried so many options before I came across this: http://beginrescueend.com/packages/openssl/

在遇到这个问题之前,我遇到了同样的问题并尝试了很多选项:http://beginrescueend.com/packages/openssl/

$ rvm pkg install openssl
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-openssl-dir=$rvm_path/usr

This resolves the issue with linecache19 rubydebug-19 and openssl:

这解决了linecache19 ruby​​debug-19和openssl的问题:

*** extconf.rb failed ***
custom_require.rb:36:in `require': no such file to load -- openssl (LoadError)

then you can do

那么你可以做到

gem install ruby-debug19