安装 Monify 时出错
Posted
技术标签:
【中文标题】安装 Monify 时出错【英文标题】:Error installing Mongify 【发布时间】:2017-01-31 06:05:57 【问题描述】:如here 所述,我安装了运行 mongify 所需的所有实用程序,但我仍然收到此错误 -
/home//.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem mongify (>= 0.a) (Gem::GemNotFoundException)
from /home//.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
from /home//.rvm/gems/ruby-2.3.0/bin/mongify:22:in `<main>'
from /home//.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /home//.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
这是我的宝石清单:
*** LOCAL GEMS ***
activemodel (4.2.7.1)
activerecord (4.2.7.1)
activesupport (4.2.7.1)
arel (6.0.4)
bigdecimal (default: 1.2.8)
bson (1.12.5)
bson_ext (1.12.5)
builder (3.2.3)
bundler (1.14.2)
bundler-unload (1.0.2)
did_you_mean (1.0.0)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
highline (1.7.8)
i18n (0.7.0)
io-console (default: 0.4.5)
json (default: 1.8.3)
json_pure (2.0.3)
minitest (5.8.3)
mongify (1.3.1)
mongo (1.12.5)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (default: 2.0.17)
rake (10.4.2)
rdoc (5.0.0, default: 4.2.1)
rubygems-bundler (1.4.4)
rubygems-update (2.6.10)
rvm (1.11.3.9)
test-unit (3.1.5)
thread_safe (0.3.5)
tzinfo (1.2.2)
【问题讨论】:
【参考方案1】:你是如何安装 gem mongify
的?如果您使用bundler
,它将帮助您修复所有依赖项,例如
» gem install mongify
Fetching: activemodel-4.2.7.1.gem (100%)
Successfully installed activemodel-4.2.7.1
Fetching: arel-6.0.4.gem (100%)
Successfully installed arel-6.0.4
Fetching: activerecord-4.2.7.1.gem (100%)
Successfully installed activerecord-4.2.7.1
Fetching: bson-1.12.5.gem (100%)
Successfully installed bson-1.12.5
Fetching: mongo-1.12.5.gem (100%)
Successfully installed mongo-1.12.5
Fetching: bson_ext-1.12.5.gem (100%)
Building native extensions. This could take a while...
Successfully installed bson_ext-1.12.5
Fetching: highline-1.7.8.gem (100%)
Successfully installed highline-1.7.8
Fetching: mongify-1.3.1.gem (100%)
Successfully installed mongify-1.3.1
8 gems installed
或者,您确定在安装该 gem 时出错了吗?检查了您的错误消息,看起来您执行了那个 gem cli mongify
?
请粘贴您的完整错误消息。我会更新我的答案。
【讨论】:
当我在终端上运行 mongify 时,这是我得到的错误 - /home/.rvm/rubies/ruby-2.3.0/lib/ ruby/site_ruby/2.3.0/rubygems.rb:270:infind_spec_for_exe': can't find gem mongify (>= 0.a) (Gem::GemNotFoundException) from /home/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in
activate_bin_path' 来自 /home/.rvm/gems/ruby-2.3.0/bin/mongify:22:in <main>' from /home/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
eval' 来自 /home /.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `root
还是你自己?您粘贴的位置内容很奇怪,请检查您当前的用户。
您可以尝试更新gem
和bundler
吗?然后再次bundle install
。
当前用户是我自己。当我运行 update_rubygems 时出现此错误 - /home/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0 /rubygems.rb:270:in find_spec_for_exe': can't find gem rubygems-update (>= 0.a) (Gem::GemNotFoundException) from /home/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in
activate_bin_path' 来自 /home/.rvm/gems/ruby-2.3.0/bin/update_rubygems:22:in <main>' from /home/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
eval' 来自 /home/.rvm/gems/ruby -2.3.0/bin/ruby_executable_hooks:15:in `这是一个宝石错误。
首先你需要找到'Gemfile'
然后运行 - cd /.gemspecs/did_you_mean-1.0.0
然后运行 - bundle install --with production
然后如果没有安装运行- gem install mysql2
现在所有必需的 gem 都已安装。
现在运行 - mongify
现在如果 mongify 正在工作,你需要检查 SQL 和 NoSQL 的连接
所以运行 - mongify 检查 database.config
在 database.config 文件中你需要这个-
sql_connection do
adapter "mysql2"
host "127.0.0.1"
username "root"
password "root"
database "database_name"
end
mongodb_connection do
host "127.0.0.1"
database "database_name"
end
现在你会看到 -
SQL 连接有效
NoSQL 连接有效
然后运行 - mongify translation database.config > translation.rb
和 - mongify process database.config translation.rb
现在数据将从 MySQL DB 迁移到 MongoDB。
要了解有关 mongify 的更多详细信息,请阅读此link
【讨论】:
那么原因是安装了gemmysql
适配器?
是的,而且所有必需的捆绑包都没有安装【参考方案3】:
For Mac:
1. Download and install the mysql installer. (https://dev.mysql.com/downloads/mysql/)
Open Terminal
2. sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
【讨论】:
以上是关于安装 Monify 时出错的主要内容,如果未能解决你的问题,请参考以下文章