LoadError:无法加载此类文件--dropbox_sdk

时间:2018-02-21 02:51:46

标签: ruby postgresql rubygems rake

我正在尝试在本地部署updog.co代码。 https://github.com/jshawl/updog。我安装了ruby,nodejs,npm,postgresql,sqlite3等。我克隆了repo,做了一个bundle install。现在我试图在终端中发出命令rake db:migrate。我收到以下错误

SQL (0.5ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150223214551"]]
   (2.4ms)  COMMIT
Migrating to CreateVersions (20150225004003)
   (0.5ms)  BEGIN
== 20150225004003 CreateVersions: migrating ===================================
-- create_table(:versions)
   (82.9ms)  CREATE TABLE "versions" ("id" serial primary key, "item_type" character varying NOT NULL, "item_id" integer NOT NULL, "event" character varying NOT NULL, "whodunnit" character varying, "object" text, "created_at" timestamp) 
   -> 0.0838s
-- add_index(:versions, [:item_type, :item_id])
   (39.2ms)  CREATE  INDEX  "index_versions_on_item_type_and_item_id" ON "versions"  ("item_type", "item_id")
   -> 0.0448s
== 20150225004003 CreateVersions: migrated (0.1289s) ==========================

  SQL (0.7ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150225004003"]]
   (20.8ms)  COMMIT
Migrating to CreateClicks (20160630134655)
   (0.5ms)  BEGIN
== 20160630134655 CreateClicks: migrating =====================================
-- create_table(:clicks)
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/justinechacko/www/updog/db/migrate/20160630134655_create_clicks.rb:6)
   (83.5ms)  CREATE TABLE "clicks" ("id" serial primary key, "data" json, "site_id" integer, "created_at" timestamp, "updated_at" timestamp) 
   -> 0.0848s
== 20160630134655 CreateClicks: migrated (0.0850s) ============================

  SQL (0.6ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20160630134655"]]
   (19.4ms)  COMMIT
Migrating to CreateSubscriptions (20161002210857)
   (0.6ms)  BEGIN
== 20161002210857 CreateSubscriptions: migrating ==============================
-- create_table(:subscriptions)
   (84.7ms)  CREATE TABLE "subscriptions" ("id" serial primary key, "stripe_id" character varying, "user_id" integer, "active_until" timestamp) 
   -> 0.0856s
== 20161002210857 CreateSubscriptions: migrated (0.0858s) =====================

  SQL (0.9ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20161002210857"]]
   (18.1ms)  COMMIT
Migrating to AddDocumentRootToSites (20161006225750)
rake aborted!
LoadError: cannot load such file -- dropbox_sdk
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/home/justinechacko/www/updog/db/migrate/20161006225750_add_document_root_to_sites.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:774:in `load_migration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:770:in `migration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `disable_ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1048:in `use_transaction?'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1040:in `ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

有一个名为updog / db / migrate / 20161006225750_add_document_root_to_sites.rb的文件

require 'dropbox_sdk'
class AddDocumentRootToSites < ActiveRecord::Migration
  def change
    add_column :sites, :document_root, :string
    Site.all.each do |site|
      p "getting #{site.name}"
      begin
        site.content(DropboxClient.new(site.creator.access_token),
          {
            'REQUEST_URI' => '/_config.yml',
            'REMOTE_ADDR' => '127.0.0.1',
            'HTTP_REFERER' => '',
            'PATH_INFO' => '/_config.yml'
          }
        )
        site.update(document_root: '_site/')
      rescue => e
        p e
      end
    end
  end
end

1 个答案:

答案 0 :(得分:0)

看起来这个项目需要dropbox-sdk gem,但是没有在Gemfile中指定它。如果它不在Gemfile中,则require语句找不到它。