未找到 Ruby rspec gem。我应该使用 gemfile 来解决这个问题吗?
我正在学习 Ruby 和 Rails。我似乎安装了 3 个版本的 rspec gem。
rspec (2.8.0, 2.7.0, 2.6.0)
rspec-core (2.8.0, 2.7.1, 2.7.0, 2.6.4)
rspec-expectations (2.8.0, 2.7.0, 2.6.0)
rspec-mocks (2.8.0, 2.7.0, 2.6.0)
我输入:
$ rspec spec
应该运行目录规范中的所有规范。我收到以下错误:
/Users/Cathy/.rvm/gems/ruby-1.9.3-p0/bin/rspec:
/Users/Cathy/.rvm/rubies/ruby-1.9.2-p290/bin/ruby:
bad interpreter: No such file or directory
我对错误的猜测是 rspec 无法判断要使用哪个版本的 gem。我想我需要设置一个 gemfile。有没有比我更好的方向或更好的答案?
我在最新的 MacBook Pro 上运行 ruby 1.9.3p0(2011-10-30 修订版 33570)[x86_64-darwin11.2.0]。
I'm learning Ruby and Rails. I seem to have 3 versions of the rspec gem installed.
rspec (2.8.0, 2.7.0, 2.6.0)
rspec-core (2.8.0, 2.7.1, 2.7.0, 2.6.4)
rspec-expectations (2.8.0, 2.7.0, 2.6.0)
rspec-mocks (2.8.0, 2.7.0, 2.6.0)
I enter:
$ rspec spec
which is supposed to run all the specs in the directory spec. I get the following error:
/Users/Cathy/.rvm/gems/ruby-1.9.3-p0/bin/rspec:
/Users/Cathy/.rvm/rubies/ruby-1.9.2-p290/bin/ruby:
bad interpreter: No such file or directory
My guess to the error is that rspec can't tell which version of the gem to use. I think I need to set up a gemfile. Are there any good directions or a better answer than mine?
I am running ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] on the latest MacBook Pro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在使用 Rails 或任何与此相关的 Ruby 项目时,Gemfile 始终是一个好主意。
Rubygems 会自动尝试使用任何 gem 的最新安装版本,因此这可能不是这里的问题。
从错误消息来看,您的 ruby 解释器似乎有问题。请注意其中一行是
1.9.3
,下一行是1.9.2
吗?这对我来说听起来有点可疑,但我不完全确定该怎么办。不过,这个问题可能会对此事有所启发。
A Gemfile is always a good idea when working with rails, or any ruby project for that matter.
Rubygems will automatically try to use the latest installed version of any gem, so that's probably not the issue here.
From the error message it looks like there's something wrong with your ruby interpreter. Notice how it says
1.9.3
on one line, and1.9.2
on the next? That sounds a bit fishy to me, however I'm not entirely sure what to do about it.This SO question might shed some light on that matter, though.