Rails - rake:gems:install - 不安装 gem
如果我在 config/environments/test.rb 文件中定义了一些 gem,如下所示:
config.gem "rspec"
config.gem "rspec-rails"
config.gem "mocha"
然后运行 'rake gems:install RAILS_ENV=test'
我会收到以下错误:
Missing these required gems:
mocha
Run `rake gems:install` to install the missing gems.
但是,如果我运行 rake gems:install 就像它说的那样继续这样递归下去直到永远。
我如何实际使用 rake (而不是 gem install)来安装 gem?
谢谢!
If i define a few gems in my config/environments/test.rb file like this:
config.gem "rspec"
config.gem "rspec-rails"
config.gem "mocha"
and then run 'rake gems:install RAILS_ENV=test'
I get the following error:
Missing these required gems:
mocha
Run `rake gems:install` to install the missing gems.
however if I run rake gems:install like it says it will continue to recurse like this forever.
How do I actually get the gems to install using rake (not gem install)?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想知道,您的 rake 文件或environment.rb 文件中是否引用了 mocha gem 中的某些内容?我以前见过类似的问题,并且它表现为此类问题。
尝试“手动”安装 mocha ...
然后看看是否可以运行
rake gems:install
。I wonder, is there a reference to something from the mocha gem in your rake file or environment.rb file? I've seen issues like this before and it presents as this type of problem.
Try installing mocha 'manually' with...
Then see if you can run
rake gems:install
.我也遇到了这个问题,并按照此处的说明进行操作解决它。具体来说,删除并重新生成 lib/tasks/rspec.rake 非常重要。另外,添加
也有
帮助。
I ran into this problem as well, and followed the directions here to resolve it. Specifically, deleting and regenerating lib/tasks/rspec.rake is pretty crucial. Also, adding
to
helped.
我发现这是一个 GEM_PATH 问题。基本上,rails 无法找到您已安装的 gem,即使它们在那里,它们也是完全不可见的。有点奇怪,但是嘿。
在 dreamhost 上,我必须配置以下行:
在 config/environment.rb 中
,但在我的开发盒上,这对我不起作用,必须完全删除。
YMMV 但我建议这是一个开始寻找的好地方。
I found this was a GEM_PATH issue. Basically, rails can't find the gems you've installed and even though they're there, they're completely invisible. A bit weird, but hey.
On dreamhost I had to configure the line:
in config/environment.rb
but on my dev box this doesn't work for me and has to be removed entirely.
YMMV but I'd suggest that's a good place to start looking.
您使用哪个平台?如果它是窗口,则
执行下面的命令及其工作
gem install mocha --platform=mswin32
Which platform are you using? If it it window then
Execute Below command and its works
gem install mocha --platform=mswin32