cap deploy:migrations:错误:第1行第1列不允许控制字符(Psych :: SyntaxError)

请看下面的错误(第1行第1列不允许使用控制字符(Psych :: SyntaxError))并帮我解决它。当我尝试在ubuntu 12.10 ruby​​上运行命令“cap deploy:migrations”时出现错误1.9.3 Rails 3.2.0。 有用于部署的本地Apache服务器。

我在stackoverflow上尝试了不同的解决方案,但没有人解决问题。

提前致谢

---------------------------------------- Error Detail: ---------------------------------------- imran@IJM:~/development/work/depot$ cap deploy:migrations triggering load callbacks * 2013-09-06 11:43:13 executing `deploy:migrations' * 2013-09-06 11:43:13 executing `deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote imran@IJM:git/depot.git master" command finished in 359ms ....... ....... * executing "[ -e /home/imran/IJM/shared/assets/manifest* ] && cat /home/imran/IJM/shared/assets/manifest* || echo" servers: ["IJM"] [IJM] executing command command finished in 822ms /home/imran/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (): control characters are not allowed at line 1 column 1 (Psych::SyntaxError) from /home/imran/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' from /home/imran/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse' from /home/imran/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load' from /h from /home/imran/.rvm/gems/ruby-1.9.3-p448/bin/cap:19:in `load' from /home/imran/.rvm/gems/ruby-1.9.3-p448/bin/cap:19:in `' from /home/imran/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval' from /home/imran/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `' ------------------------------------------------------------------------------------------- deploy.rb ------------------------------------------------------------------------------------------- #--- # Excerpted from "Agile Web Development with Rails", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information. #--- require 'bundler/capistrano' # be sure to change these set :user, 'imran' set :domain, 'IJM' set :application, 'depot' # adjust if you are using RVM, remove if you are not require "rvm/capistrano" set :rvm_ruby_string, '1.9.3' set :rvm_type, :user # file paths set :repository, "#{user}@#{domain}:git/#{application}.git" set :deploy_to, "/home/#{user}/#{domain}" # distribute your applications across servers (the instructions below put them # all on the same server, defined above as 'domain', adjust as necessary) role :app, domain role :web, domain role :db, domain, :primary => true # you might need to set this if you aren't seeing password prompts #default_run_options[:pty] = true default_run_options[:pty] = true #default_run_options[:shell] = '/bin/bash' # As Capistrano executes in a non-interactive mode and therefore doesn't cause # any of your shell profile scripts to be run, the following might be needed # if (for example) you have locally installed gems or applications. Note: # this needs to contain the full values for the variables set, not simply # the deltas. # default_environment['PATH']=':/usr/local/bin:/usr/bin:/bin' # default_environment['GEM_PATH']=':/usr/lib/ruby/gems/1.8' # miscellaneous options set :deploy_via, :remote_cache set :scm, 'git' set :branch, 'master' set :scm_verbose, true set :use_sudo, false set :rails_env, :production #IJM #set :whenever_command, "bundle exec whenever" namespace :deploy do desc "cause Passenger to initiate a restart" task :restart do run "touch #{current_path}/tmp/restart.txt" end desc "reload the database with seed data" task :seed do run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}" end end ------------------------------------------------------------------------------------------- .bashrc ------------------------------------------------------------------------------------------- # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples #PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting #[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 ------------------------------------------------------------------------------------------- .bash_profile ------------------------------------------------------------------------------------------- [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && \ . "$HOME/.rvm/scripts/rvm" #source ~/.bashrc export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 

我上周遇到了同样的问题,我解决了这个问题

“这是你的钩子/home/rails/.rvm/hooks/after_use_textmate – 禁用它(chmod -x),rvm将不再为它生成包装器。”

基于此问题https://github.com/wayneeseguin/rvm/issues/1964#issuecomment-19410325