简体   繁体   English

RVM,Ruby和Rails安装中的gem问题

[英]Issue with gems in RVM, Ruby and Rails installation

I have been trying to get my dev environment setup on my computer for a number of days now, but without any luck. 我已经尝试在计算机上安装开发环境好几天了,但是没有任何运气。 I've had more error messages than I could care to remember and my installation problems have been anything but consistent. 我收到的错误消息超出了我的记忆范围,而且我的安装问题一直很严重。

My current problem is unknown as I don't know where its stemming from. 我目前的问题是未知的,因为我不知道它的根源。

When I try to check my gem version gem -v , the terminal locks up for a couple minutes and then gives me this output: 当我尝试检查我的gem版本gem -v ,终端会锁定几分钟,然后显示以下输出:

/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Argument list too long
/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Undefined error: 0

The entire contents of that file are as follows: 该文件的全部内容如下:

#!/usr/bin/env bash

if [[ -s "/Users/Riley/.rvm/environments/ruby-2.0.0-p0" ]]
then
  source "/Users/Riley/.rvm/environments/ruby-2.0.0-p0"
  exec gem "$@"
else
  echo "ERROR: Missing RVM environment file: '/Users/Riley/.rvm/environments/ruby-2.0.0-p0'" >&2
  exit 1
fi

And I don't have a clue what its supposed to be, if not that. 我不知道应该是什么,如果不是那样的话。 Checking which ruby gives me: 检查which ruby给我:

/Users/Riley/.rvm/bin/ruby

And the problem really seems to come alive when I try to install rails, gem install rails : 当我尝试安装rails, gem install rails时,问题似乎真的还存在:

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

** This error has ceased to occur and is now replaced with the above "line 6" error for gem -v , however I'm sure it will show up again. **此错误已不再发生,现在被上述gem -v “第6行”错误所代替,但是我确定它会再次出现。

I have also tried all of this: 我也尝试了所有这些方法:

rvm get head --autolibs=3
rvm pkg remove
rvm reinstall all --force

and all the other renditions of solutions on SO and many other sites. 以及SO和许多其他站点上解决方案的所有其他形式。

I would greatly appreciate someone helping me with this setup as I don't have any solution to my problem outside of google and SO. 我将不胜感激有人帮助我进行此设置,因为我在google和SO之外无法解决我的问题。

The problem stemmed from my installation of Ruby. 问题出在我的Ruby安装上。 Apparently, as stated in this answer , "a non-LLVM version of GCC" is no longer included in the XCode command line tools. 显然, 如此答案所述 ,“ XCC的非LLVM版本”不再包含在XCode命令行工具中。

Installing ruby with: 使用以下命令安装ruby:

rvm install ruby --with-gcc=clang

Worked and I installed RVM, Ruby and Rails within about 10 minutes, despite it taking me a week of debugging and reinstalling otherwise. 工作正常,尽管花了我一周的调试和重新安装时间,但我还是在大约10分钟内安装了RVM,Ruby和Rails。

Run rvm requirements and install all the dependencies as specified (openssl being one of them). 运行rvm requirements并按照指定的方式安装所有依赖项(openssl是其中之一)。 It should fix your problem. 它应该可以解决您的问题。

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

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