2014-06-16 26 views
0

我看到NoMethodError:未定義的方法`取」爲‘QLite 3.x版本’:字符串

SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xxx.xx: rake exit status: 1 
rake stdout: Nothing written 
rake stderr: rake aborted! 
NoMethodError: undefined method `fetch' for "QLite version 3.x":String 

此錯誤是由日命令調用,當我嘗試部署我的Rails應用到生產這個錯誤

Command: cd /home/deploy/myapp/releases/20140616034148 && (RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake assets:precompile) 

capfile

# Load DSL and Setup Up Stages 
require 'capistrano/setup' 

# Includes default deployment tasks 
require 'capistrano/deploy' 
require 'capistrano/bundler' 
require 'capistrano/rails' 
require 'capistrano/rvm' 
set :rvm_ruby_version, '2.1.2' 
require 'capistrano/rails/assets' 
require 'capistrano/rails/migrations' 

deploy.rb

lock '3.1.0' 
set :application, 'myapp' 
set :repo_url, '[email protected]:username/myapp.git' 
set :deploy_to, '/home/deploy/myapp' 
set :branch, "master" 
set :linked_files, %w{config/database.yml} 
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} 
namespace :deploy do 
    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     # Your restart mechanism here, for example: 
     execute :touch, release_path.join('tmp/restart.txt') 
    end 
    end 

production.rb

set :stage, :production 
role :app, %w{[email protected]} 
role :web, %w{[email protected]} 
role :db, %w{[email protected]} 
set :password, ask('Server password', nil) 
server '107.170.187.98', user: 'deploy', password: fetch(:password), roles: %w{web app} 
set :bundle_env_variables, { 'NOKOGIRI_USE_SYSTEM_LIBRARIES' => 1 } 

我不明白是什麼原因造成了這個問題。有人可以指出我的方向是正確的嗎?

回答

3

檢查您在生產服務器上設置的config/database.yml文件。它的第一行可能是「QLite version 3.x」 - 這是因爲它曾經是「#SQLite version 3.x」,但最初的「#S」已經丟失。

要解決這個問題,只需將「#S」添加到它的前面,或者完全刪除該行。一旦你完成了,你的Capistrano部署應該再次開始工作。


我猜你把你的config/database.yml文件從其他地方粘貼到Vim實例中;出於完全相同的原因,我遇到與您完全相同的問題。如果在粘貼之前不將Vim置入插入模式,它將粘貼整個事物,但會從前面放下「#S」。

這三個特別被刪除的原因是因爲這些字母實際上是Vim命令。如果您不處於插入模式,則粘貼某些內容時,這些命令將會運行。這三個人物,在粘貼時,做序列如下:

  • - 將光標移動到上一次搜索的上一個出現。因爲我們沒有搜索任何東西,所以沒有任何反應。
  • space - 將光標向右移動一次。由於編輯器中沒有內容,因此沒有任何反應。
  • S - 刪除S之前的行數。由於S之前沒有數字,因此不會被刪除。一旦完成,我們進入插入模式,並粘貼文檔的其餘部分。

來源:http://vimdoc.sourceforge.net/htmldoc/

+0

謝謝,這是確切的問題 – Arun

相關問題