找不到 gem“rails”;头痛
我使用的是 Mac OS X 10.6 Snow Leopard。我刚刚使用以下方法更新了我的 Ruby 内容:
sudo gem update
不幸的是,它破坏了一切。当我尝试在我的网站目录中运行一个简单的命令时,例如:
rails generate model User
它失败了,并出现以下错误:
在 Gemfile 中列出的任何 gem 源中都找不到 gem“rails(= 3.0.3,运行时)”。 尝试运行
bundle install
。
所以我尝试运行bundle install Rails
。成功了!所以我尝试运行rails
。它失败了。所以我尝试通过输入以下内容来获取 Rails 版本:
rails -v
失败并出现此错误:
在任何来源中都找不到 rake-0.8.7
尝试运行bundle install
。
但它不仅失败了,还在我的网站目录中创建了一个空文件夹 rails/ruby/1.8
。
这对我来说完全是一场灾难,因为我只是 Ruby 和 Ruby on Rails 的初学者,甚至是终端的初学者。任何帮助将不胜感激。谢谢。
I'm on Mac OS X 10.6 Snow Leopard. I just updated my Ruby stuff using:
sudo gem update
Unfortunately, it broke everything. When I try to run a simple command in my website directory, like:
rails generate model User
It failed, with this error:
Could not find gem 'rails (= 3.0.3, runtime)' in any of the gem sources listed in your Gemfile.
Try runningbundle install
.
So I tried running bundle install rails
. It succeeded! So I tried running rails
. It failed. So I tried getting the Rails version by entering:
rails -v
Which failed with this error:
Could not find rake-0.8.7 in any of the sources
Try runningbundle install
.
But not only did it fail, it also created an empty folder rails/ruby/1.8
in my website directory.
This is a complete disaster for me as I am just a beginner in Ruby and Ruby on Rails, and even in the Terminal. Any help would be MUCH appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有这一切都源于机架版本不完全是 1.0.1 iirc。
即使您有之前的版本,您的整个设置也无法正确安装。
卸载所有版本的机架并确保您只有该版本。
正如贾斯汀在评论中所说,现在获取 RVM。跑,别走。
all this stems from having a version of rack that is not exactly 1.0.1 iirc.
Even if you have a version ahead of it, your whole setup will not install properly.
Uninstall all versions of rack and make sure you only have that one.
As Justin said in your comments, now get rvm. Run, don't walk.