php_serialize gem不加载

时间:2014-01-31 14:44:28

标签: ruby

我正在尝试使用这个创业板:

PHP Serialize

我输入

gem install php-serialize

和我的main.rb Ruby应用程序

require 'php_serialize'

结果是

Boot Error

Something went wrong while loading main.rb

LoadError: cannot load such file -- php_serialize

环境是Sinatra,在我的main.rb中我有:

require 'rubygems'
require 'sanitize'
require 'sinatra'
require 'active_record'
require 'nokogiri'
require 'open-uri'
require 'uri'
require 'pry'
require 'chronic' 
require 'json'
require 'zip'
require 'php_serialize'

有什么想法吗?

更新

RubyGems Environment:
  - RUBYGEMS VERSION: 2.1.11
  - RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin13.0.0]
  - INSTALLATION DIRECTORY: /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353
  - RUBY EXECUTABLE: /Users/scrivoaroby/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353/bin
  - SPEC CACHE DIRECTORY: /Users/scrivoaroby/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-13
  - GEM PATHS:
     - /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353
     - /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353/bin
     - /Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353@global/bin
     - /Users/scrivoaroby/.rvm/rubies/ruby-2.0.0-p353/bin
     - /Users/scrivoaroby/.rvm/bin
     - /usr/local/git/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/bin
     - /usr/local/git/bin
     - /opt/ImageMagick/bin

哪支霰弹枪

/Users/scrivoaroby/.rvm/gems/ruby-2.0.0-p353/bin/shotgun

    2.0.0
== Shotgun/Thin on http://127.0.0.1:9393/
Thin web server (v1.6.1 codename Death Proof)
Maximum connections set to 1024
Listening on 127.0.0.1:9393, CTRL+C to stop

2 个答案:

答案 0 :(得分:0)

我们可以使用更多的背景; “引导错误”不是简单的Ruby消息。环境是什么?

但是当Ruby程序找不到gem时,问题通常就是其中之一:

  1. Ruby版本低于1.9,而您首先没有require "rubygems"

  2. 多个Ruby安装和程序使用的是与安装gem的程序不同的一个。

  3. 程序正在使用Bundler,而gem不在Gemfile中。

  4. 宝石另外安装在与程序使用的$GEM_HOME不同的{{1}}中。

答案 1 :(得分:0)

假设这是一个简单的脚本,你没有Bundler或任何其他gem管理系统,你需要require 'rubygems'才需要任何gem。

main.rb

require 'rubygems'
require 'php_serialize'