Spork 配置错误?:“require”:没有要加载的文件
我是 Ruby & 新手Rails,目前正在研究 Rails 教程。具体来说,我目前正在研究书中需要 设置 Spork。
不幸的是,当我输入时
spork
,我看到
Using RSpec
-- Rinda Ring Server listening for connections...
-- Starting to fill pool...
Wait until at least one slave is provided before running tests...
** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
magazine_slave (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from magazine_slave_provider.rb:5:in `<main>'
最后 4 行重复。
好吧,很简单,这似乎是 lib/rubygems/custom_require 中的问题。
项目 lib 目录不包含 rubygems 子目录,因此我假设它位于 ruby 目录中;但事实并非如此。那么 rubygems 是某种虚拟目录吗?
$ dir *custom_require*.* /s/b
所以 html文件
C:\Ruby192\lib\ruby\1.9.1\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\gems\1.9.1\doc\rubygems-1.6.2\rdoc\lib\rubygems\custom_require_rb.html
C:\Ruby192\lib\ruby\gems\1.9.1\gems\rubygems-update-1.6.2\lib\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\site_ruby\1.9.1\rubygems\custom_require.rb
显然不是这样,并且以下文件的第 29 行有注释。
C:\Ruby192\lib\ruby\gems\1.9.1\gems\rubygems-update-1.6.2\lib\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\site_ruby\1.9.1\rubygems\custom_require.rb
第29行有代码,
C:\Ruby192\lib\ruby\1.9.1\rubygems\custom_require.rb
但是当我注释掉代码时,仍然出现错误,当我删除29行之前的注释时,错误行号没有改变。
有人可以告诉我这可能是什么吗?
I'm new to Ruby & Rails, and am currently working on the Rails Tutorial. Specifically I am currently working on the part of the book where I need to setup Spork.
Unfortunately when I enter
spork
I get
Using RSpec
-- Rinda Ring Server listening for connections...
-- Starting to fill pool...
Wait until at least one slave is provided before running tests...
** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
magazine_slave (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from magazine_slave_provider.rb:5:in `<main>'
with the last 4 lines repeating.
Ok, simple enough, it appears to be a problem in lib/rubygems/custom_require.
The project lib dir doesn't contain a rubygems subdirectory, so I'm assuming it's in the ruby directory; but it isn't. So is rubygems some kind of virtual dir?
$ dir *custom_require*.* /s/b
Yeilds
C:\Ruby192\lib\ruby\1.9.1\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\gems\1.9.1\doc\rubygems-1.6.2\rdoc\lib\rubygems\custom_require_rb.html
C:\Ruby192\lib\ruby\gems\1.9.1\gems\rubygems-update-1.6.2\lib\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\site_ruby\1.9.1\rubygems\custom_require.rb
So the html file obviously isn't it, and line 29 on the following files have comments.
C:\Ruby192\lib\ruby\gems\1.9.1\gems\rubygems-update-1.6.2\lib\rubygems\custom_require.rb
C:\Ruby192\lib\ruby\site_ruby\1.9.1\rubygems\custom_require.rb
There is code on line 29 of
C:\Ruby192\lib\ruby\1.9.1\rubygems\custom_require.rb
But when I commented out the code, I still got the error, and when I removed comments on lines before 29, the error line number did not change.
Can anybody throw me a bone as to what this might be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,这就是我为解决问题所做的事情。
我对这个解决方案并不完全感到兴奋,并且觉得它留下了更多未解答的问题,但它可能为未来遇到类似问题的人提供提示。
我最初是在 RubyInstaller 之前安装 BitNami Ruby 的,所以我认为可能有一些配置至少部分使用 Bitnami,而不是 RubyInstaller。所以我卸载了 RubyInstaller、BitNami。然后我重新安装了 RubyInstaller 并重新运行了教程中的所有 gem 安装等。
我
不幸的是,虽然我不再收到上述错误,但我收到了另一个错误。
magazine_slave_provider.rb:5:in 'require': 没有要加载的文件 -- magazine_slave (LoadError)
来自 magazine_slave_provider.rb:5:in '
'
至少我可以找到这个文件&我通过将
require 'magazine_slave'
替换为require File.dirname(__FILE__) + '/magazine_slave'
解决了这个问题,
这似乎解决了我的问题,尽管它看起来确实如此就像我只是掩盖了一个更大问题的症状一样。当其他人似乎没有遇到此问题时,这似乎不太可能是实际问题。
Ok, here's what I did to solve the problem.
I'm not totally thrilled with the solution, and feel it leaves many more unanswered questions, but it may provide a hint to future people with similar problems.
I originally installed BitNami Ruby before RubyInstaller, so I thought there might be configurations somewhere that was at least partially using Bitnami, instead of RubyInstaller. So I uninstalled RubyInstaller, the BitNami. Then I reinstalled RubyInstaller and reran all gem installs etc, from the tutorial.
Unfortunately, while I no longer got the error above, I was getting a different one.
magazine_slave_provider.rb:5:in 'require': no such file to load -- magazine_slave (LoadError)
from magazine_slave_provider.rb:5:in '<main>'
At least I could find this file & I solved this, by replacing
require 'magazine_slave'
withrequire File.dirname(__FILE__) + '/magazine_slave'
This seemed to resolve the problem for me, although it does seem like I just covered up a sympton of a bigger issue. It seems unlikely this is the actual problem when nobody else seems to be having this problem.