【发布时间】:2015-07-10 09:39:00
【问题描述】:
我正在使用this tutorial to deploy my app to VPS。我在 DigitalOcean 上创建了 Ubuntu 服务器。我已经完成了所有这些步骤。但是在第 11 步,我必须编写此代码:
bundle exec cap production deploy
它给我一个错误:
rake aborted!
DEBUG [280721fe] LoadError: cannot load such file -- nokogiri
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/sanitize_helper.rb:3:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/sanitize_helper.rb:3:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:32:in `<module:TextHelper>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:29:in `<module:Helpers>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:6:in `<module:ActionView>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:4:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:6:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_helper.rb:4:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_helper.rb:4:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:50:in `<module:Helpers>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:4:in `<module:ActionView>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:3:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAssetTagHelper>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/helper.rb:54:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/helper.rb:54:in `<module:Helper>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/helper.rb:7:in `<module:Rails>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/helper.rb:6:in `<module:Sprockets>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/helper.rb:5:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/railtie.rb:6:in `require'
DEBUG [280721fe] /var/www/newsapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/railtie.rb:6:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/releases/20150710090114/config/application.rb:10:in `require'
DEBUG [280721fe] /var/www/newsapp/releases/20150710090114/config/application.rb:10:in `<top (required)>'
DEBUG [280721fe] /var/www/newsapp/releases/20150710090114/Rakefile:4:in `require'
DEBUG [280721fe] /var/www/newsapp/releases/20150710090114/Rakefile:4:in `<top (required)>'
DEBUG [280721fe] (See full trace by running task with --trace)
Ubuntu 无法加载 nokogiri。我在它尝试运行rake assets:precompile 命令时发生。
我在 Windows 7 上编写了这个项目并将其上传到我的 BitBucket 存储库。我以为 Capistrano 自己运行 bundle install 并更改 Gemfile.lock。
我在 Windows 7 x64 上运行的本地计算机使用 Ruby 2.1.5。
我在 Ubuntu Server 14.04 x64 上运行的 VPS 使用 Ruby 2.2.0。
我需要做什么?
==== 更新 ====
我想,因为我已经在 Windows 上编写了这个应用程序并尝试将其上传到 Ubuntu,所以我的 Gemfile.lock 会有所不同。我已删除它并尝试将其上传到我的 VPS,它说它无法运行我的应用程序,因为我没有Gemfile.lock。
==== 更新 ====
我已经重启了我的 VPS。我听说 Nokogiri 与 Ruby 的 2.2 版本有冲突,所以我安装了 2.1.6 版本。仍然在预编译时给我这个错误。
==== 更新 ====
我发现在我的 Ubuntu 每一个我想开始的 rake 任务中都会抛出这个错误。
【问题讨论】:
-
Capistrano 自己不会做任何事情,,,, 如果你在 deploy.rb 中指定这个,只有这样它才会这样做,否则它不会
-
我查看了控制台日志,发现它运行 bundler
Running /usr/bin/env bundle install --path /var/www/newsapp/shared/bundle --without development test --deployment --quiet。但是它仍然在预编译时出错。这样做是因为我的项目是在 Windows 上编写的吗? -
你有来自
bundle install的输出吗?nokogiri需要libxml2和libxslt- 你的 VPS 上安装了吗?
标签: ruby-on-rails ruby ubuntu capistrano nokogiri