Spork 配置错误?:“require”:没有要加载的文件

发布于 2024-10-31 00:21:02 字数 1805 浏览 6 评论 0原文

我是 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 目录不包含 ruby​​gems 子目录,因此我假设它位于 ruby​​ 目录中;但事实并非如此。那么 ruby​​gems 是某种虚拟目录吗?

$ 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁梦 2024-11-07 00:21:02

好的,这就是我为解决问题所做的事情。

我对这个解决方案并不完全感到兴奋,并且觉得它留下了更多未解答的问题,但它可能为未来遇到类似问题的人提供提示。

  1. 我最初是在 RubyInstaller 之前安装 BitNami Ruby 的,所以我认为可能有一些配置至少部分使用 Bitnami,而不是 RubyInstaller。所以我卸载了 RubyInstaller、BitNami。然后我重新安装了 RubyInstaller 并重新运行了教程中的所有 gem 安装等。

  2. 不幸的是,虽然我不再收到上述错误,但我收到了另一个错误。

    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.

  1. 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.

  2. 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' with require 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文