[英]Failed to deploy app via Capistrano, LoadError: cannot load such file — nokogiri
I'm using this tutorial to deploy my app to VPS . 我正在使用本教程将应用程序部署到VPS 。 I have created Ubuntu Server on DigitalOcean. 我已经在DigitalOcean上创建了Ubuntu Server。 I have proceeded all theese steps. 我已经完成了所有这些步骤。 However on 11th step I must to write this code: 但是,在第11步中,我必须编写以下代码:
bundle exec cap production deploy
It throws me an error: 它引发了一个错误:
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 failed to load nokogiri
. Ubuntu无法加载nokogiri
。 I happens when It tries to run rake assets:precompile
command. 当它尝试运行rake assets:precompile
命令时,我发生了。
I have written this project on Windows 7 and uploaded it to my BitBucket repository. 我已经在Windows 7上编写了该项目,并将其上传到我的BitBucket存储库。 I thought that Capistrano runs bundle install
by itself and changes Gemfile.lock
. 我以为Capistrano自己运行bundle install
并更改Gemfile.lock
。
My local computer running on Windows 7 x64 uses Ruby 2.1.5. 我在Windows 7 x64上运行的本地计算机使用Ruby 2.1.5。
My VPS running on Ubuntu Server 14.04 x64 uses Ruby 2.2.0. 我在Ubuntu Server 14.04 x64上运行的VPS使用Ruby 2.2.0。
What do I need to do? 我需要做什么?
==== Update ==== ====更新====
I thought that, because I have written this app on Windows and trying to upload it to Ubuntu, my Gemfile.lock
will be different. 我以为,因为我已经在Windows上编写了该应用程序,并试图将其上传到Ubuntu,所以我的Gemfile.lock
将有所不同。 I have deleted it and tried to upload it to my VPS and it says that It can not run my app because I have not Gemfile.lock
. 我已删除它,并尝试将其上传到我的VPS,它说它无法运行我的应用程序,因为我没有Gemfile.lock
。
==== Update ==== ====更新====
I have restarted my VPS. 我已经重新启动了VPS。 I heard that Nokogiri has conflicts with 2.2 Verisons of Ruby so I have installed 2.1.6 version. 我听说Nokogiri与Ruby 2.2 Verisons冲突,因此我安装了2.1.6版本。 Still it gives me this error on precompile. 仍然给我这个关于预编译的错误。
==== Update ==== ====更新====
I have found that inmy Ubuntu every rake task that I want to start throws me this error. 我发现在我的Ubuntu中,我想启动的所有rake任务都会引发此错误。
我读到Nokogiri在最新版本的Ruby(2.2)上存在一些问题,也许您应该考虑在服务器上回滚到Ruby 2.1。
I have found solution and I think it is not good. 我找到了解决方案,但我认为这不好。
In my Gemfile.lock
I have deleted all -64x-mingw
strings, leaving only name and verison number of my gems. 在我的Gemfile.lock
我删除了所有-64x-mingw
字符串,仅保留了宝石的名称和版本号。
In platform I simply wrote ruby
instead of mingw
. 在平台上,我只是写ruby
而不是mingw
。
Well... that worked. 好吧...行得通。
Heroku deletes Windows Gemfile.lock
and generates new one automatically. Heroku删除Windows Gemfile.lock
并自动生成一个新文件。 Is it possible to send to capistrano that kind of commands? 是否可以向capistrano发送这种命令?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.