1

我正在使用 Mina 将 Rail 应用程序部署到 VPS(数字海洋)。

当我使用时,mina deploy我不断收到相同的错误:

rake aborted!
LoadError: cannot load such file -- nokogiri

    C:\Sites\app>mina deploy --trace
    ** Invoke deploy (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Invoke rvm:use (first_time)
    ** Execute rvm:use
    ** Execute deploy
    ** Invoke git:clone (first_time)
    ** Execute git:clone
    ** Invoke deploy:link_shared_paths (first_time)
    ** Execute deploy:link_shared_paths
    ** Invoke bundle:install (first_time)
    ** Execute bundle:install
    ** Invoke rails:db_migrate (first_time)
    ** Execute rails:db_migrate
    ** Invoke rails:assets_precompile (first_time)
    ** Execute rails:assets_precompile
    ** Invoke deploy:cleanup (first_time)
    ** Execute deploy:cleanup
    user@45.45.45.45's password:
    -----> Using RVM environment 'ruby-2.2.1@default'
    $ rvm use "ruby-2.2.1@default" --create
    Using /usr/local/rvm/gems/ruby-2.2.1
    -----> Creating a temporary build path
    $ touch "deploy.lock"
    $ mkdir -p "./tmp/build-%s2267"
    $ cd "./tmp/build-%s2267"
    -----> Fetching new git commits
    $ (cd "/home/user/app/scm" && git fetch "git@bitbucket.org:user/app.git" "master:master" --force)
    Enter passphrase for key '/home/user/.ssh/id_rsa':
    -----> Using git branch 'master'
    $ git clone "/home/user/app/scm" . --recursive --branch "master"
    Cloning into '.'...
    done.
    -----> Using this git commit

    $ git --no-pager log --format='%%%%aN (%%%%h):%%%%n> %%%%s' -n 1 %aN (%h):%n> %s
    $ rm -rf .git

    -----> Symlinking shared paths
    $ mkdir -p "./config"
    $ mkdir -p "."
    $ rm -rf "./config/database.yml"
    $ ln -s "/home/user/app/shared/config/database.yml" "./config/database.yml"
    $ rm -rf "./log"
    $ ln -s "/home/user/app/shared/log" "./log"de
    -----> Installing gem dependencies using Bundler
    $ mkdir -p "/home/user/app/shared/bundle"
    $ mkdir -p "./vendor"
    $ ln -s "/home/user/app/shared/bundle" "./vendor/bundle"
    $ bundle install --without development:test --path "./vendor/bundle" --deployment
    Fetching gem metadata from https://rubygems.org/............
    Fetching version metadata from https://rubygems.org/...
    Fetching dependency metadata from https://rubygems.org/..
    Using rake 10.4.2
    Using i18n 0.7.0
    Using json 1.8.2
    Using minitest 5.6.1
    Using thread_safe 0.3.5
    Using tzinfo 1.2.2
    Using activesupport 4.2.0
    Using builder 3.2.2
    Using erubis 2.7.0
    Using rails-deprecated_sanitizer 1.0.3
    Using rails-dom-testing 1.0.6
    Using loofah 2.0.2
    Using rails-html-sanitizer 1.0.2
    Using actionview 4.2.0
    Using rack 1.6.1
    Using rack-test 0.6.3
    Using actionpack 4.2.0
    Using globalid 0.3.5
    Using activejob 4.2.0
    Using mime-types 2.5
    Using mail 2.6.3
    Using actionmailer 4.2.0
    Using activemerchant 1.47.0
    Using activemodel 4.2.0
    Using arel 6.0.0
    Using activerecord 4.2.0
    Using acts_as_list 0.7.2
    Using addressable 2.3.8
    Using execjs 2.5.2
    Using autoprefixer-rails 5.1.11
    Using awesome_nested_set 3.0.2
    Using sass 3.4.13
    Using bootstrap-sass 3.3.4.1
    Using camertron-eprun 1.1.0
    Using cancancan 1.10.1
    Using bundler 1.8.4
    Using thor 0.19.1
    Using railties 4.2.0
    Using sprockets 3.0.3
    Using sprockets-rails 2.3.0
    Using rails 4.2.0
    Using canonical-rails 0.0.9
    Using carmen 1.0.2
    Using cldr-plurals-runtime-rb 1.0.0
    Using climate_control 0.0.3
    Using cocaine 0.5.7
    Using coffee-script-source 1.8.0
    Using coffee-script 2.4.1
    Using coffee-rails 4.1.0
    Using colorize 0.7.7
    Using css_parser 1.3.6
    Using daemons 1.2.2
    Using polyglot 0.3.5
    Using deface 1.0.1
    Using orm_adapter 0.5.0
    Using responders 2.1.0
    Using warden 1.2.3
    Using devise 3.4.1
    Using devise-encryptable 0.1.2
    Using eventmachine 1.0.7
    Using ffaker 1.32.1
    Using font-awesome-rails 4.3.0.0
    Using friendly_id 5.1.0
    Using friendly_id-globalize 1.0.0.alpha1
    Using globalize 5.0.1
    Using highline 1.6.21
    Using htmlentities 4.3.3
    Using multi_xml 0.5.5
    Using httparty 0.13.3
    Using i18n_data 0.5.1
    Using multi_json 1.11.0
    Using jbuilder 2.2.13
    Using jquery-rails 4.0.3
    Using jquery-ui-rails 5.0.3
    Using kaminari 0.16.3
    Using kaminari-i18n 0.3.2
    Using khipu 1.3.5
    Using open4 1.3.4
    Using mina 0.3.4
    Using money 6.5.1
    Using monetize 1.3.0
    Using paperclip 4.2.1
    Using paranoia 2.1.2
    Using polyamorous 1.2.0
    Using premailer 1.8.4
    Using premailer-rails 1.8.1
    Using rabl 0.9.4.pre1
    Using rails-i18n 4.0.4
    Using ransack 1.4.1
    Using rdoc 4.2.0
    Using tilt 1.4.1
    Using sass-rails 5.0.3
    Using sdoc 0.4.1
    Using select2-rails 3.5.9.1
    Using state_machines 0.2.2
    Using state_machines-activemodel 0.1.2
    Using state_machines-activerecord 0.2.0
    Using stringex 2.5.2
    Using truncate_html 0.9.2
    Using twitter_cldr 3.1.2
    Using spree_core 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-stable
    )
    Using versioncake 2.3.1
    Using spree_api 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-stable)

    Using spree_backend 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-sta
    ble)
    Using spree_cmd 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-stable)

    Using spree_frontend 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-st
    able)
    Using spree_sample 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-stab
    le)
    Using spree 3.0.2.beta from git://github.com/spree/spree.git (at 3-0-stable)
    Using spree_auth_devise 3.0.0 from git://github.com/spree/spree_auth_devise.git
    (at 3-0-stable)
    Using spree_gateway 3.0.0.beta from git://github.com/spree/spree_gateway.git (at
     3-0-stable)
    Using spree_i18n 3.0.0 from git://github.com/spree/spree_i18n.git (at 3-0-stable
    )
    Using spree_slider 1.2.0 from git://github.com/spree-contrib/spree_slider.git (a
    t master)
    Using spree_static_content 2.3.0 from git://github.com/spree-contrib/spree_stati
    c_content.git (at 3-0-stable)
    Using thin 1.6.3
    Using turbolinks 2.5.3
    Using uglifier 2.7.1
    Bundle complete! 25 Gemfile dependencies, 116 gems now installed.
    Gems in the groups development and test were not installed.
    Bundled gems are installed into ./vendor/bundle.
    -----> Migrating database
    $ RAILS_ENV="production" bundle exec rake db:migrate
    rake aborted!
    LoadError: cannot load such file -- nokogiri
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/loofah-2.0.2/l
    ib/loofah.rb:3:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/loofah-2.0.2/l
    ib/loofah.rb:3:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/rails-html-san
    itizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/rails-html-san
    itizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/sanitize_helper.rb:3:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/sanitize_helper.rb:3:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/text_helper.rb:32:in `<module:TextHelper>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/text_helper.rb:29:in `<module:Helpers>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/text_helper.rb:6:in `<module:ActionView>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/text_helper.rb:4:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_tag_helper.rb:6:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_helper.rb:4:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers/form_helper.rb:4:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers.rb:50:in `<module:Helpers>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers.rb:4:in `<module:ActionView>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/actionview-4.2
    .0/lib/action_view/helpers.rb:3:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAsset
    TagHelper>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>'

    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/helper.rb:54:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/helper.rb:54:in `<module:Helper>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/helper.rb:7:in `<module:Rails>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/helper.rb:6:in `<module:Sprockets>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/rails/helper.rb:5:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/railtie.rb:6:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sprockets-rail
    s-2.3.0/lib/sprockets/railtie.rb:6:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass/rails/railtie.rb:3:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass/rails/railtie.rb:3:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass/rails.rb:11:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass/rails.rb:11:in `<top (required)>'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass-rails.rb:1:in `require'
    /home/user/app/tmp/build-%s2267/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0
    .3/lib/sass-rails.rb:1:in `<top (required)>'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    76:in `require'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    76:in `block (2 levels) in require'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    72:in `each'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    72:in `block in require'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    61:in `each'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:
    61:in `require'
    /usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler.rb:134:in `
    require'
    /home/user/app/tmp/build-%s2267/config/application.rb:7:in `<top (required)>
    '
    /home/user/app/tmp/build-%s2267/Rakefile:4:in `require'
    /home/user/app/tmp/build-%s2267/Rakefile:4:in `<top (required)>'
    (See full trace by running task with --trace)
    ! ERROR: Deploy failed.
    -----> Cleaning up build
    $ rm -rf "./tmp/build-%s2267"
    Unlinking current
    $ rm -f "deploy.lock"
    OK   
    Connection to 45.45.45.45 closed.

除了 Nokogiri 之外,似乎所有必要的 gem 都已安装。我不知道如何解决这个问题。

这是我的 Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'coffee-script-source', '1.8.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'khipu'
gem 'mina'
gem 'nokogiri', '1.6.1'
# gem 'unicorn'
gem 'spree_khipu', :path => '../spree_khipu'

gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spree', github: 'spree/spree', branch: '3-0-stable'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'spree_i18n', :github => 'spree/spree_i18n', branch: '3-0-stable'
gem 'spree_slider', github: 'spree-contrib/spree_slider'
gem 'spree_static_content', github: 'spree-contrib/spree_static_content', branch: '3-0-stable'
gem 'bootstrap-sass', '~> 3.3.4'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'thin'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


group  :production do
  gem 'pg'
 end
4

1 回答 1

1

最后bundle install在 linux 机器上解决这个问题,以便Gemfile.lock更新,然后我再试一次mina deploy,一切正常。无法弄清楚我以前版本的确切问题是什么Gemfile.lock

于 2015-07-21T23:58:38.037 回答