[英]Having errors with rake db:create
I'm trying to install fat free crm with ruby on rails on Windows 7, but when I put the command 我正在尝试在Windows 7的导轨上使用ruby安装无脂的crm,但是当我输入命令时
rake db:create RAILS_ENV=production
it says 它说
rake aborted!
LoadError: cannot load such -- 2.1/pg_ext
Normally, it would say what gem I should install, but not in this case. 通常,它会说我应该安装什么宝石,但在这种情况下则不会。
How can I solve this error? 我该如何解决这个错误?
Edit: 编辑:
A friend of mine suggested to uncomment mysql2 and comment pg on the Gemfile file in the proyect like this: 我的一个朋友建议取消注释mysql2并在proyect中的Gemfile文件上注释pg,如下所示:
gem 'mysql2'
#gem 'sqlite3'
#gem 'pg'
But now I get this: 但是现在我得到了:
Unable to load the EventMachine C extension; To use the pure-ruby reactor, requi
re 'em/pure_ruby'
C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': ca
nnot load such file -- 2.1/rubyeventmachine (LoadError)
Have any ideas of why this happends? 有什么想法为什么会这样?
Here is my Gemfile: 这是我的Gemfile:
source 'https://rubygems.org'
# Uncomment the database that you have configured in config/database.yml
# ----------------------------------------------------------------------
gem 'mysql2'
# gem 'sqlite3'
# gem 'pg'
# Removes a gem dependency
def remove(name)
@dependencies.reject! {|d| d.name == name }
end
# Replaces an existing gem dependency (e.g. from gemspec) with an alternate source.
def gem(name, *args)
remove(name)
super
end
# Bundler no longer treats runtime dependencies as base dependencies.
# The following code restores this behaviour.
# (See https://github.com/carlhuda/bundler/issues/1041)
spec = Bundler.load_gemspec( File.expand_path("../fat_free_crm.gemspec", __FILE__) )
spec.runtime_dependencies.each do |dep|
gem dep.name, *(dep.requirement.as_list)
end
# Remove premailer auto-require
gem 'premailer', :require => false
# Remove fat_free_crm dependency, to stop it from being auto-required too early.
remove 'fat_free_crm'
group :development do
# don't load these gems in travis
unless ENV["CI"]
gem 'thin'
gem 'quiet_assets'
gem 'capistrano'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rvm'
#~ gem 'capistrano-chruby'
#~ gem 'capistrano-rbenv'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rails'
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
end
end
group :development, :test do
gem 'rspec-rails', '~> 2'
gem 'headless'
gem 'debugger', :platforms => 'mri_19' unless ENV["CI"]
gem 'byebug', :platforms => ['mri_20', 'mri_21'] unless ENV["CI"]
gem 'pry-rails' unless ENV["CI"]
end
group :test do
gem 'capybara'
gem 'selenium-webdriver'
gem 'database_cleaner'
gem "acts_as_fu"
gem 'factory_girl_rails'
gem 'zeus' unless ENV["CI"]
gem 'coveralls', :require => false
gem 'timecop'
end
group :heroku do
gem 'unicorn', :platform => :ruby
gem 'rails_12factor'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'execjs'
gem 'therubyracer', :platform => :ruby unless ENV["CI"]
end
gem 'turbo-sprockets-rails3'
It sounds like you are missing the pg gem from your Gemfile. 听起来您好像缺少Gemfile中的pg gem。 Is it in the development group? 在开发小组中吗?
Can you post your Gemfile? 您可以发布您的Gemfile吗?
Uncomment #gem pg
. 取消注释#gem pg
。
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
is a separate error. Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
是一个单独的错误。 Where did you get that Gemfile? 您从哪里获得该Gemfile?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.