无法启动WEBrick,Rails gem文件夹为空 [英] Can't boot WEBrick, the folder for Rails gem is empty
问题描述
我遵循Michael Hartl的 Ruby on Rails教程,并且我试图在我的Windows 7计算机上启动Rails服务器。
我试图按照 Chapter 1.2.5。,即通过键入
rails server
但是,不要启动WEBrick ,这将返回使用'rails'命令的说明。我一直在Google上搜索一段时间,其中一些答案似乎暗示着rails gem出了问题。
现在,我已经找到了rails gem文件夹(C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\rails-3.2.3),它是空的!
当我尝试时
rails -v
它返回Rails 3.2.16,尽管我已经删除了这个版本的gem;如果我尝试
宝石列表
它一直告诉我该版本是3.2.3。
直到我删除了railties 3.2.16,导致
rails -v
返回'Rails 3.2.3',但我仍然无法启动使用WEBrick。
任何帮助将不胜感激。
我见过更多的人有同样的问题,但我发现的解决方案都没有帮助我,所以这里是这对我来说是什么,尽管我并不是100%确定这件事到底是什么......
我遵循了建议@ scarver2回应了我的其他问题,并从我全新安装的Ruby 1.9.3中卸载 Rails
和 Railties
gems。 (我已经使用 RailsInstaller 安装了它)。然后,我通过键入
gem来安装 Rails 3.2.16
gem安装rails -v 3.2.16
并且这也安装了相应的 Railties 3.2 .16
gem没有我的介入。
Gemfile
中引用 ruby
版本的行实际上对应于我的Ruby版本已安装。 我输入了
ruby -v
code>
,以确保我的版本是1.9.3。确实。确认这一点,我在我的应用程序中编辑了 Gemfile
,所以它说
ruby'1.9.3'
而不是 ruby'2.0.0清单1.5中使用的
行。
之后,我只需进入我的应用程序文件夹,然后键入
控制台中的 bundle update
bundle install
它没有像我以前的尝试那样返回任何错误。之后,输入
rails server
完成了它应该有的功能,并启动了我的WEBrick服务器,允许我在本地主机上访问我的应用程序。 Yay!
现在,我认为可能出错了,最后一次是我搞砸了 Gemfile
,所以宝石版本和他们的依赖关系搞砸了。我还假设通过安装和卸载不同版本的各种gem来无法解决这个问题并不完全有帮助。可能有帮助的是卸载 Rails
和 Railties
gems,并安装 Rails
gem again。
I'm following Michael Hartl's Ruby on Rails tutorial, and I got stuck at trying to start rails server on my Windows 7 machine.
I'm trying to do this by following instructions in Chapter 1.2.5., i.e. by typing
rails server
However, instead of booting WEBrick, this returns the instructions for usage of 'rails' command. I've been googling this for a while, and some of the answers seem to have implied that something is wrong with the rails gem.
Now, I've found the rails gem folder ("C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\rails-3.2.3"), and it's empty!
Also when I try
rails -v
it returns "Rails 3.2.16", although I've removed this version of the gem; if I try
gem list
it kept telling me that the version is 3.2.3.
This persisted until I deleted railties version 3.2.16, which resulted in
rails -v
returning 'Rails 3.2.3', but I still can't boot WEBrick.
Any help would be appreciated.
OK, I've managed to solve my problem.
I've seen a few more people having the same issue, but none of the solutions that I've found helped me, so here's what did it for me, though I'm not 100% sure what exactly was that one thing that actually did it...
I've followed the advice @scarver2 gave in response to my other question, and uninstalled both Rails
and Railties
gems from my crispy fresh installation of Ruby 1.9.3. (I've installed it using RailsInstaller). Then I've installed Rails 3.2.16
gem by typing
gem install rails -v 3.2.16
and this also installed the corresponding Railties 3.2.16
gem without my intervention.
Then I followed steps from chapters 1.2.3. and 1.2.5. of the tutorial, but making sure that line referencing ruby
version in my Gemfile
actually corresponds to the version of Ruby that I have installed.
I typed
ruby -v
in the console, to make sure that I have version 1.9.3. indeed. Confirming this, I've edited the Gemfile
in my app so it says
ruby '1.9.3'
instead of ruby '2.0.0'
line that's used in Listing 1.5. of the tutorial.
After that I've simply went to my app folder, and typed
bundle update
bundle install
in the console, and this time it did not return any errors as it did in my previous attempts. After that, typing
rails server
did what it should have, and my WEBrick server booted, allowing me to access my app on localhost. Yay!
Now, what I think may have gone wrong the last time was either me screwing up the Gemfile
, so the gem versions and their dependencies got messed up. I also assume that ineptly trying to fix this by installing and uninstalling different versions of various gems did not quite help. What may have helped was uninstalling Rails
and Railties
gems, and installing Rails
gem again.
这篇关于无法启动WEBrick,Rails gem文件夹为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!