rake db:migrate因版本差异而中止

时间:2014-04-24 08:24:08

标签: ruby-on-rails ruby gem rake

我正在尝试在localhost:3000中加载我的rails应用程序但是我遇到了一些与我的rake版本相关的错误。

当我使用rails server启动服务器然后在浏览器中刷新时,此错误会显示在我的服务器日志中:

ActiveRecord::PendingMigrationError - Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.:
activerecord (4.0.4) lib/active_record/migration.rb:383:in `check_pending!'
activerecord (4.0.4) lib/active_record/migration.rb:370:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.4) lib/active_support/callbacks.rb:373:in `run__4154752559951713534__call__callbacks'
activesupport (4.0.4) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.4) lib/rails/engine.rb:511:in `call'
railties (4.0.4) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/AaronWilliamson/.rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/AaronWilliamson/.rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/AaronWilliamson/.rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'

但是,当我按照错误的建议运行bin/rake db:migrate RAILS_ENV=development时,我收到以下错误:

Aarons-iMac:ripelist-classifieds AaronWilliamson$ bin/rake db:migrate RAILS_ENV=development
== 20140424074405 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateColumn: ERROR:  column "email" of relation "users" already exists
: ALTER TABLE "users" ADD COLUMN "email" character varying(255) DEFAULT '' NOT NULL/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:442:in `block in log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:437:in `log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:360:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:393:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (3 levels) in <class:Table>'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `block (2 levels) in <class:Table>'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:5:in `block in up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:334:in `change_table'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:629:in `block in method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `block in say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:621:in `method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:387:in `method_missing'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:3:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:538:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:578:in `exec_migration'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:559:in `block (2 levels) in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:558:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:557:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:713:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:963:in `block in execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `block in ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:221:in `within_new_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/transactions.rb:209:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:962:in `execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:924:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:768:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:746:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR:  column "email" of relation "users" already exists
: ALTER TABLE "users" ADD COLUMN "email" character varying(255) DEFAULT '' NOT NULL
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:442:in `block in log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:437:in `log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:360:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:393:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (3 levels) in <class:Table>'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `block (2 levels) in <class:Table>'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:5:in `block in up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:334:in `change_table'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:629:in `block in method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `block in say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:621:in `method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:387:in `method_missing'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:3:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:538:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:578:in `exec_migration'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:559:in `block (2 levels) in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:558:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:557:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:713:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:963:in `block in execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `block in ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:221:in `within_new_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/transactions.rb:209:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:962:in `execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:924:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:768:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:746:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
PG::DuplicateColumn: ERROR:  column "email" of relation "users" already exists
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:442:in `block in log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_adapter.rb:437:in `log'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:360:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:393:in `add_column'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (3 levels) in <class:Table>'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:488:in `block (2 levels) in <class:Table>'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:5:in `block in up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:334:in `change_table'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:629:in `block in method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `block in say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:601:in `say_with_time'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:621:in `method_missing'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:387:in `method_missing'
/Users/AaronWilliamson/Ripelist-Classifieds/db/migrate/20140424074405_add_devise_to_users.rb:3:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:538:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:578:in `exec_migration'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:559:in `block (2 levels) in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:558:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:557:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:713:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:963:in `block in execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `block in ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:221:in `within_new_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/transactions.rb:209:in `transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:1009:in `ddl_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:962:in `execute_migration_in_transaction'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:924:in `block in migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `each'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:920:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:768:in `up'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/migration.rb:746:in `migrate'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

此外,当我尝试运行像rake routes之类的简单命令时,我收到此错误:

Aarons-iMac:ripelist-classifieds AaronWilliamson$ rake routes
rake aborted!
Gem::LoadError: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this.
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:34:in `block in setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:19:in `setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/AaronWilliamson/Ripelist-Classifieds/config/boot.rb:4:in `<top (required)>'
/Users/AaronWilliamson/Ripelist-Classifieds/config/application.rb:1:in `<top (required)>'
/Users/AaronWilliamson/Ripelist-Classifieds/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/AaronWilliamson/Ripelist-Classifieds/config/boot.rb:4:in `<top (required)>'
/Users/AaronWilliamson/Ripelist-Classifieds/config/application.rb:1:in `<top (required)>'
/Users/AaronWilliamson/Ripelist-Classifieds/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

My Gemfile如下所示:

source 'https://rubygems.org'

gem 'rails'
gem 'pg'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'bcrypt'
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"
gem 'bootstrap-sass'
gem 'bootstrap-sass-extras'
gem 'email_validator'
gem 'devise'
gem 'dimensions-rails'
gem 'unicorn'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'quiet_assets'
  gem 'letter_opener'
end

group :test, :development do
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'launchy'
  gem 'capybara'
  gem 'faker'
end

group :test do
  gem 'shoulda-matchers'
end

我正在使用rails版本4.0.4

我使用的是ruby版本2.1.0p0(2013-12-25修订版44422)[x86_64-darwin13.0]

我对rails很新,所以非常感谢外行人的条款,以帮助我理解这个问题。我只想让我的应用程序运行,我的rake配置重回正轨。

2 个答案:

答案 0 :(得分:1)

问题在于gem rake ,只需使用命令bundle update rake更新此Gem,它就可以在运行迁移时解决问题。

答案 1 :(得分:0)

从你的日志:

  

PG :: DuplicateColumn:错误:列&#34;电子邮件&#34;关系&#34;用户&#34;   已存在

这意味着您在上次迁移20140424074405 AddDeviseToUsers时尝试创建已存在的列。

尝试删除此迁移。 关于rake也来自log:

  

您已经激活了rake 10.3.1,但您的Gemfile需要rake   10.2.2。将bundle exec添加到您的命令可能会解决此问题。

这意味着你运行rake routes它是执行rake安装在系统而非项目中,用于在项目使用中运行bundle exec rake routes