简体   繁体   English

即使使用RVM,也无法安装Ruby / Rails

[英]Problems installing Ruby/Rails, even with RVM

So here is what happened: I started working for a company and was given a macbook pro for work. 所以这就是发生的事情:我开始在一家公司工作,并得到了Macbook Pro上班。 I do customer support for Exceptional/Airbrake so i need to learn Ruby/Rails. 我为Exceptional / Airbrake提供客户支持,所以我需要学习Ruby / Rails。 So the laptop had a previous owner and i dont know what he did with it. 所以笔记本电脑有一个以前的所有者,我不知道他是怎么做的。

I tried to install Ruby and Rails and kept getting errors, then tried doing it with rvm, and i thought it was working as i could run irb and even execute a test program with ruby. 我尝试安装Ruby和Rails并不断出错,然后尝试使用rvm进行操作,并且我认为它可以正常运行,因为我可以运行irb甚至使用ruby执行测试程序。 I got tired of seeing the previous owners name on the command line so i changed the home folder and I am pretty sure this is where things got bad. 我已经厌倦了在命令行上看到以前的所有者名称,所以我更改了主文件夹,并且我很确定这是问题所在。 I took the contents of rvm and everything and moved it to my User file from the old one then deleted the old one. 我获取了rvm的内容以及所有内容,并将其从旧文件移至我的用户文件,然后删除了旧文件。

Everything seemed to still be working fine, but when I wanted to start working with rails as well, t it wouldnt work.So i figured i would just uninstall everything and start over, i tried rvm implode and removed all gems. 一切似乎仍然可以正常工作,但是当我也想开始使用rails时,它就无法工作。所以我想我将卸载所有一切并重新开始,我尝试rvm内爆并移除了所有宝石。 when i run 'gem list', i get empty, and i cant find ruby anywhere but when i run irb, it still works. 当我运行“宝石列表”时,我变得空了,我在任何地方都找不到红宝石,但是当我运行irb时,它仍然有效。 so i tried re-installing using rvm, but i keep getting errors. 所以我尝试使用rvm重新安装,但我不断收到错误消息。

The first error that occurs is: 发生的第一个错误是:

No binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.

the second error is: 第二个错误是:

Error running 'env GEM_PATH=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0@global:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0@global GEM_HOME=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0 /Users/robertmroz/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /Users/robertmroz/.rvm/src/rubygems-2.0.3/setup.rb', please read /Users/robertmroz/.rvm/log/ruby-2.0.0-p0/rubygems.install.log

and the last error is: 最后一个错误是:

ERROR:  Loading command: install (LoadError)
cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

I have gone through dozens of google searches, most of them leading me here, on each of these errors, and sometimes the certain error seems to be fixed, but in the end i cant get it to work. 我经历了数十次谷歌搜索,其中大多数都将我引到了这些错误的每一个上,有时某些错误似乎已解决,但最终我无法使它正常工作。 Should i just wipe the OS and start over, cause I have been trying to get this done for days now. 我是否应该擦除操作系统并重新开始,因为几天来我一直在努力完成此任务。

BTW, i dont know why it is installing 2.0.0 i thought rvm installed the latest version by default. 顺便说一句,我不知道为什么要安装2.0.0,我认为rvm默认安装了最新版本。

Before you blow out the system I'd: 在吹灭系统之前,我会:

  1. Uninstall rvm ( rvm implode , gem uninstall rvm ) see this question 卸载rvm( rvm implodegem uninstall rvm )看到这个问题
  2. You should be left with just the base ruby. 您应该只剩下基本的红宝石。 That should be the only one left. 那应该是剩下的唯一一个。
  3. Re-install rvm ( \\curl -L https://get.rvm.io without Rails). 重新安装rvm( \\curl -L https://get.rvm.io 不带 Rails)。
  4. Install the ruby version you want with rvm ( rvm install 1.9.2 ) stay away from 2.0 for now. 使用rvm rvm install 1.9.2想要的ruby版本( rvm install 1.9.2rvm install 1.9.2不使用2.0。
  5. Make sure your ruby version is installed and selected. 确保已安装并选择您的ruby版本。
  6. Install the rails version you want. 安装所需的rails版本。

Hopefully that will straighten things out. 希望那会理顺一切。

I also suffered from the same problems while installing Ruby , but after googling a lot I found the solution . 在安装Ruby时,我也遇到了同样的问题,但是经过大量搜索之后,我找到了解决方案。 Follow the below process : 请遵循以下过程:

  1. If you have already installed anything uninstall all of that using Revo installer or by some other means , else go to step 2. 如果您已经安装了任何工具,请使用Revo安装程序或通过其他方式卸载所有工具,否则请转到步骤2。
  2. Next go to http://rubyinstaller.org/ and press the download button . 接下来转到http://rubyinstaller.org/ ,然后按下载按钮。
  3. You will find a list of ruby versions , click on the latest version ( If you are running a 64 bit machine install the link with (x-64) else install the one without brackets . 您会找到红宝石版本的列表,单击最新版本(如果您正在运行64位计算机,请使用(x-64)安装链接,否则请安装不带括号的链接。
  4. Accept all the defaults and tick all the check boxes after downloading and setting it up , it will install in C:\\ with name Ruby22 ( depending on its version ) 接受所有默认设置并下载并设置所有复选框,然后将其安装在C:\\中,名称为Ruby22(取决于其版本)
  5. Go to start menu type cmd , the use the command "cd C:\\" without brackets , it will take you the C:\\ drive 进入开始菜单,键入cmd,使用不带括号的命令“ cd C:\\”,它将带您到C:\\驱动器
  6. Check ruby -v , you should get the version number , else repeat the above process again . 检查ruby -v,您应该获得版本号,否则再次重复上述过程。
  7. Now use the command "gem install rails" , it will install all the rails requirements , this takes a lot of time . 现在使用命令“ gem install rails”,它将安装所有rails要求,这需要很多时间。
  8. Now use the command "gem install webrick" to install the web server 现在,使用命令“ gem install webrick”来安装Web服务器
  9. Now go to some browser , visit http://rubyinstaller.org/downloads/ , download the DevKit at the bottom of the page and extract it to some folder ( ex in C:\\DevKit after creating the DevKit folder in C:\\ ) 现在转到某个浏览器,访问http://rubyinstaller.org/downloads/ ,在页面底部下载DevKit并将其解压缩到某个文件夹(在C:\\中创建DevKit文件夹后,在C:\\ DevKit中)
  10. Use the following commands in the same order 以相同的顺序使用以下命令
    "ruby dk.rb init" “ ruby​​ dk.rb初始化”
    "ruby dk.rb install" "gem install rdiscount --platform=ruby" “ ruby​​ dk.rb安装”“ gem安装rdiscount --platform = ruby​​”
  11. Rails is installed now . Rails现在已安装。
  12. Create a folder in C:\\ for creating your rails apps and name the folder ( ex Rails _Apps ) use the command cd C:\\Rails_apps to go there and use the command "rails new sample_rails_app" to create a Rails app with the name "sample_rails_app" . 在C:\\中创建一个文件夹以创建您的Rails应用程序,并命名该文件夹(例如Rails _Apps),使用命令cd C:\\ Rails_apps转到此处,并使用命令“ rails new sample_rails_app”创建一个名为“ sample_rails_app”。
  13. It does a bunch of things and you are now able to use Ruby on Rails. 它可以完成很多事情,您现在可以使用Ruby on Rails。

Ruby 2.0.0-p0 was recently released, so that is the latest version technically, although I kind of doubt you really want the latest version since it is so new and your company may still be running an older version like 1.9.3. Ruby 2.0.0-p0是最近发布的,因此从技术上讲这是最新版本,尽管我有点怀疑您真的想要最新版本,因为它是如此新,并且您的公司可能仍在运行旧版本,如1.9.3。 Have you tried installing 1.9.3-p392 (the current 1.9.3 version)? 您是否尝试安装1.9.3-p392(当前的1.9.3版本)?

If you still get the error with 1.9.3, I would try the instructions shown on the RVM site : 如果仍然出现1.9.3错误,我将尝试RVM站点上显示的说明:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM