【问题标题】:Syntax Error within Gemfile (Capistrano)Gemfile (Capistrano) 中的语法错误
【发布时间】:2015-06-25 17:07:45
【问题描述】:

Capistrano 给我一个错误,说我在错误的位置放置了一个冒号,而我什至没有。我应该怎么做才能解决这个问题?我猜只是指定 sdoc 会起作用,但我不确定正确的语法是什么。 gem 'sdoc', '~> 0.4.0' 失败。

错误:(求和)

(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as haldenkr@weareamnesia.com: bundle exit status: 4
bundle stdout: Gemfile syntax error:
/home/haldenkr/public_html/qwestera/releases/20150625170018/Gemfile:11: syntax
error, unexpected ':', expecting $end
gem 'sdoc', '~> 0.4.0', group: :doc
                              ^
bundle stderr: Nothing written

宝石文件

source 'https://rubygems.org'

gem 'rails', '4.2.1'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'devise'
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
gem 'mailcatcher'
gem 'rails_12factor'
gem 'capistrano'
gem 'capistrano-passenger'
gem 'capistrano-rails'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

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

ruby "2.2.2"

完整的错误文本:

DEBUG [697ff6d6]    Gemfile syntax error:
DEBUG [697ff6d6]    /home/haldenkr/public_html/qwestera/releases/20150625180749/Gemfile:11: syntax
DEBUG [697ff6d6]    error, unexpected ':', expecting $end
DEBUG [697ff6d6]    gem 'sdoc', '~> 0.4.0', group: :doc
DEBUG [697ff6d6]                                  ^
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as haldenkr@weareamnesia.com: bundle exit status: 4
bundle stdout: Gemfile syntax error:
/home/haldenkr/public_html/qwestera/releases/20150625180749/Gemfile:11: syntax
error, unexpected ':', expecting $end
gem 'sdoc', '~> 0.4.0', group: :doc
                              ^
bundle stderr: Nothing written

SSHKit::Command::Failed: bundle exit status: 4
bundle stdout: Gemfile syntax error:
/home/haldenkr/public_html/qwestera/releases/20150625180749/Gemfile:11: syntax
error, unexpected ':', expecting $end
gem 'sdoc', '~> 0.4.0', group: :doc
                              ^
bundle stderr: Nothing written

Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as haldenkr@weareamnesia.com: bundle exit status: 4
bundle stdout: Gemfile syntax error:
/home/haldenkr/public_html/qwestera/releases/20150625180749/Gemfile:11: syntax
error, unexpected ':', expecting $end
gem 'sdoc', '~> 0.4.0', group: :doc
                              ^
bundle stderr: Nothing written

【问题讨论】:

  • 你真的在运行 Ruby 1.9+ 吗?
  • 除非发生某种奇怪的诡计,否则我相信我是。 $ ruby --version ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
  • 你能在你的服务器上确认一下吗?如果你创建一个打印 Ruby 版本的 Cap 任务怎么办?
  • @jmdeldin 我是个白痴。出于某种原因,我认为只在本地检查是可以的。我的服务器是 1.8.7,所以我有点搞砸了,因为它是共享主机

标签: ruby-on-rails syntax capistrano gemfile


【解决方案1】:

添加Gemfile

group :doc do
  gem 'sdoc', require: false
end

然后bundle install

【讨论】:

  • 恐怕没有骰子:/ 仍然得到同样的错误。我已经添加了日志的完整错误部分,以防我遗漏任何重要信息。
【解决方案2】:

由于您的远程服务器正在运行 Ruby

gem 'sdoc', '~> 0.4.0', :group => :doc

但是,请立即更改为 Ruby 2.2+ 主机 -- 不支持 1.8.7 并且速度非常慢。

【讨论】:

    猜你喜欢
    • 2014-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    相关资源
    最近更新 更多