简体   繁体   English

Rails中的ZenTest错误

[英]ZenTest Error in Rails

I am following the tutorial on railstutoiral.org and encounter the following error: "ZenTest is not part of the bundle. Add it to Gemfile. (Gem::LoadError)." 我正在关注railstutoiral.org上的教程,并遇到以下错误:“ ZenTest不属于捆绑软件。将其添加到Gemfile中。(Gem :: LoadError)。” I have ZenTest (4.4.2) installed according to gemlist so what's wrong? 我已经根据gemlist安装了ZenTest(4.4.2),所以怎么了? Thanks! 谢谢!

Open 'Gemfile' in the root of your rails application, and add a section like this to the bottom: 在rails应用程序的根目录中打开“ Gemfile”,并在底部添加如下所示的部分:

group :development, :test do
  gem 'ZenTest'
end

Then at the command line, type: 然后在命令行中键入:

bundle install

This command will install the gem and associate it with your application. 此命令将安装gem并将其与您的应用程序关联。 It might take a few minutes :) 可能要花几分钟:)

The cause of your problem is that under rails 3, rubygems are managed by a tool called bundler , which manages all the dependencies between your gems and ensures that your application is always started with the right versions of the right gems, even when you move it between servers. 问题的原因是在rails 3下,rubygems由称为bundler的工具管理,该工具管理您gem之间的所有依赖关系,并确保您的应用程序始终以正确的gem的正确版本启动,即使您移动它也是如此。服务器之间。

One more thing to note is that if you want to run a command from a gem you've installed using bundler, you need to type 'bundle exec <command>' to ensure the right environment is established to run the command. 还有一点要注意的是,如果要从使用捆绑程序安装的gem运行命令,则需要键入'bundle exec <command>'以确保建立正确的环境来运行该命令。

Even if you have it installed it isn't getting loaded because it says it isn't in the Gemfile. 即使安装了它,它也不会被加载,因为它说它不在Gemfile中。 The Gemfile exists at the root of your project directory. Gemfile位于项目目录的根目录下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM