Heroku Ruby Sinatra耙错误

时间:2014-05-31 12:35:33

标签: ruby heroku sinatra rake

过去几周我一直在研究Ruby Sinatra应用程序,现在我正在尝试在Heroku上部署我的应用程序,但是无法让rake任务工作,并且会感激一些帮助。

几个小时后,我现在已经设法启动应用程序,我可以毫无错误地使用它。但我希望能够运行我的种子"任务是能够添加管理员用户。

由于这个错误我无法运行命令" Heroku运行db:seed"。

命令错误:

Running `rake db:seed` attached to terminal... up, run.9714
rake aborted!
cannot load such file -- rspec/core/rake_task
/app/rakefile:23:in `require'
/app/rakefile:23:in `block in <top (required)>'
/app/rakefile:21:in `<top (required)>'
(See full trace by running task with --trace)

推送错误:

Fetching repository, done.
Counting objects: 7, done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 410 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rack
-----> Using Ruby version: ruby-2.1.0
-----> Installing dependencies using 1.5.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Using rake (10.1.0)
       Using bcrypt (3.1.7)
       Using addressable (2.3.5)
       Using backports (3.6.0)
       Using timers (1.1.0)
       Using nio4r (1.0.0)
       Using fastercsv (1.5.5)
       Using json (1.8.1)
       Using multi_json (1.9.2)
       Using json_pure (1.8.1)
       Using uuidtools (2.1.4)
       Using stringex (1.5.1)
       Using ffi (1.9.3)
       Using rb-fsevent (0.9.4)
       Using rack (1.5.2)
       Using tilt (1.4.1)
       Using rubysl-securerandom (2.0.0)
       Using pg (0.17.1)
       Using temple (0.6.7)
       Using celluloid (0.15.2)
       Using bundler (1.5.2)
       Using data_objects (0.10.14)
       Using bcrypt-ruby (3.1.5)
       Using rb-inotify (0.9.3)
       Using dm-core (1.2.1)
       Using rack-protection (1.5.2)
       Using rack-test (0.6.2)
       Using slim (2.0.2)
       Using celluloid-io (0.15.0)
       Using do_postgres (0.10.14)
       Using dm-aggregates (1.2.0)
       Using sinatra (1.4.4)
       Using dm-migrations (1.2.0)
       Using dm-timestamps (1.2.0)
       Using dm-serializer (1.2.2)
       Using dm-constraints (1.2.0)
       Using dm-types (1.2.2)
       Using dm-validations (1.2.0)
       Using dm-do-adapter (1.2.0)
       Using listen (2.7.1)
       Using sinatra-contrib (1.4.2)
       Using dm-transactions (1.2.0)
       Using dm-postgres-adapter (1.2.0)
       Using data_mapper (1.2.0)
       Using rerun (0.9.0)
       Using sinatra-partial (0.4.0)
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (0.65s)
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
       Could not detect rake tasks
       ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
       and using the production group of your Gemfile.
       This may be intentional, if you expected rake tasks to be run
       cancel the build (CTRL+C) and fix the error then commit the fix:
       rake aborted!
       cannot load such file -- rspec/core/rake_task
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/rakefile:23:in `require'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/rakefile:23:in `block in <top (required)>'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/task_manager.rb:196:in `in_namespace'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/dsl_definition.rb:104:in `namespace'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/rakefile:21:in `<top (required)>'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/rake_module.rb:25:in `load'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/rake_module.rb:25:in `load_rakefile'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:637:in `raw_load_rakefile'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:94:in `block in load_rakefile'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:165:in `standard_exception_handling'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:93:in `load_rakefile'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:77:in `block in run'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:165:in `standard_exception_handling'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/2.1.0/rake/application.rb:75:in `run'
       /tmp/build_e454e1f9-d7ee-425e-b596-7852f5cf95f8/vendor/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
       vendor/bundle/bin/rake:16:in `load'
       vendor/bundle/bin/rake:16:in `<main>'
-----> Discovering process types
       Procfile declares types -> web
       Default types for Ruby  -> console, rake

-----> Compressing... done, 19.0MB
-----> Launching... done, v9

的Gemfile:

source 'https://rubygems.org'
ruby '2.1.0'

gem 'sinatra'
gem 'sinatra-partial'
gem 'data_mapper'
gem 'dm-sqlite-adapter', :group => :development
gem 'slim'
gem 'tilt', '~> 1.4.1' #temporary fix
gem 'rerun'
gem 'rubysl-securerandom'
gem 'sinatra-contrib'

group :production do
  gem 'rake'
  gem "pg"
  gem "dm-postgres-adapter"
end

Enviroment.rb:

Dir["./models/*.rb"].each {|model| require model}

configure :production do
  require_relative '../app'
  DataMapper.setup(:default, ENV['HEROKU_POSTGRESQL_PURPLE_URL'])
end

DataMapper.finalize

Procfile:

web: bundle exec rackup config.ru -p $PORT

1 个答案:

答案 0 :(得分:1)

由于某些原因,rake db:seed需要rspec - 似乎在/app/rakefile的第23行。我可以看到你的Gemfile中缺少这个 - 尝试将rspec添加到你的Gemfile,推送到Heroku,然后再试一次。

相关问题