【问题标题】:Can't load PDFKIT - getting a load error无法加载 PDFKIT - 出现加载错误
【发布时间】:2012-03-07 07:44:36
【问题描述】:

我正在尝试设置 PDFKit,但我什至无法运行我的应用程序。我不断收到此错误:

`require': cannot load such file -- pdfkit (LoadError)

这是我的整个 application.rb 文件。

require File.expand_path('../boot', __FILE__)

require 'rails/all'
require 'pdfkit'

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
   Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  #Bundler.require(:default, :assets, Rails.env)
end

module Form
  class Application < Rails::Application

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password]


    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets
    config.assets.version = '1.0'
    config.middleware.use PDFKit::Middleware

  end
end

我已按照 pdfkit wiki 页面上的说明进行操作,但我被此错误困扰。我认为它找不到 pdfkit gem,但似乎已安装。请帮忙。

【问题讨论】:

  • 好的,我找到了 pdfkit 的路径 - 现在是什么
  • 删除require 'pdfkit'到application.rb的底部
  • 完成了 - 仍然给我同样的错误
  • 你使用 RVM 吗?您可以在控制台(irb、pry 或 rails 控制台)中尝试require 'pdfkit' 吗?
  • 要求 irb 中的 pdfkit 现在返回 false ..

标签: ruby ruby-on-rails-3 pdfkit


【解决方案1】:

从 application.rb 中删除 require 'pdfkit'

添加到您的Gemfile

gem "pdfkit"

然后从 Rails 根目录运行 bundle 命令。

【讨论】:

    猜你喜欢
    • 2020-04-03
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 2013-08-02
    • 1970-01-01
    相关资源
    最近更新 更多