简体   繁体   English

安装的宝石Rails“缺少这些必需的宝石”错误

[英]Rails “Missing these required gems” error for installed gems

I know this has been asked multiple times before, but I've tried those things and still am not having any luck. 我知道之前已经多次询问过,但我已经尝试过这些东西,但仍然没有运气。

For the mechanize gem, I keep getting the "Missing these required gems" error when I run db:migrate on my production server. 对于mechanize gem,当我在生产服务器上运行db:migrate时,我不断收到“Missing these required gems”错误。

Here's the full error: 这是完整的错误:

Missing these required gems:
  mechanize  

You're running:
  ruby 1.8.6.111 at /usr/bin/ruby1.8
  rubygems 1.3.5 at /home/user/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8

Output of which ruby is /usr/bin/ruby which ruby输出是/usr/bin/ruby

Output of which gem is /usr/bin/gem which gem输出是/usr/bin/gem

When I run gem list mechanize (1.0.0) is definitely in the list. 当我运行gem list mechanize (1.0.0)肯定在列表中。

What am I doing wrong here? 我在这做错了什么?

There is a chance that you may require i different version of the mechanize gem. 您可能需要我不同版本的机械宝石。 Try to work out what version of the gem its looking for. 尝试找出它寻找的宝石版本。

您可能需要不同的版本,请尝试

rake gems:install

What's the output of which rake ? 什么是which rake的输出?

The output of which ruby is /usr/bin/ruby , while the rake task reports /usr/bin/ruby1.8 . which ruby的输出是/usr/bin/ruby ,而rake任务报告/usr/bin/ruby1.8 Unless one is a symlink to the other, I suspect something is awry in your environment. 除非一个是另一个的符号链接,否则我怀疑你的环境中存在一些问题。

Also, looks like you have some gems installed in your user folder. 此外,看起来您的用户文件夹中安装了一些gem。 Have you tried installed the gem system-wide with sudo gem install or sudo rake gems:install ? 您是否曾尝试使用sudo gem installsudo rake gems:install gem系统范围sudo rake gems:install

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

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