Rails 中的 ZenTest 错误
我正在关注 Railstutoiral.org 上的教程,但遇到以下错误:“ZenTest 不是捆绑包的一部分。将其添加到 Gemfile。(Gem::LoadError)。”我已经根据 gemlist 安装了 ZenTest (4.4.2),那么有什么问题吗?谢谢!
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)." I have ZenTest (4.4.2) installed according to gemlist so what's wrong? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Rails 应用程序的根目录中打开“Gemfile”,然后在底部添加如下部分:
然后在命令行中键入:
此命令将安装 gem 并将其与您的应用程序关联。可能需要几分钟:)
问题的原因是在 Rails 3 下,rubygems 由一个名为 bundler,它管理 gem 之间的所有依赖关系,并确保您的应用程序始终以正确的 gem 的正确版本启动,即使您在服务器之间移动应用程序也是如此。
还要注意的另一件事是,如果您想从使用捆绑器安装的 gem 运行命令,则需要输入“bundle exec”以确保建立正确的环境来运行命令。
Open 'Gemfile' in the root of your rails application, and add a section like this to the bottom:
Then at the command line, type:
This command will install the gem and associate it with your application. 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.
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.
即使您安装了它,它也不会被加载,因为它说它不在 Gemfile 中。 Gemfile 位于项目目录的根目录中。
Even if you have it installed it isn't getting loaded because it says it isn't in the Gemfile. The Gemfile exists at the root of your project directory.