我刚刚开始从Michael Hartl那里开始执行" Ruby on Rails教程"我创建了一个新项目。我的Gemfile来自下面的代码:
#ruby-gemset=railstutorial_rails_4_0
的Gemfile:
gem 'rails', '4.0.8'
group :development do
gem 'sqlite3', '1.3.8'
end
gem 'sass-rails', '4.0.3'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
之后我尝试在终端执行
$ bundle install --without production
然后我得到了以下错误
nikhil@ubuntu:~/rails_projects/demo_app$ bundle install --without production
/home/nikhil/rails_projects/demo_app/Gemfile:29:in `evaluate': compile error (SyntaxError)
/home/nikhil/rails_projects/demo_app/Gemfile:23: syntax error, unexpected ':', expecting kEND
gem 'sdoc', '0.3.20', require: false
^
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
from /usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:222:in `install'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:389:in `start'
from /usr/bin/bundle:13
我是一个刚刚尝试研究RoR的新手,请帮我解决这个错误 感谢
答案 0 :(得分:0)
查看评论,问题几乎肯定是由Gemfile中的以下行引起的:
#Gemfile
group :doc do
gem 'sdoc', '0.3.20', require: false
end
根据其他问题的答案,您很可能可以使用以下语法解决问题:
#Gemfile
group :doc do
gem 'sdoc', '0.3.20', :require => false
end
<强>捆扎机强>
感谢评论中的@mandeep
,您还希望了解更新bundler
的版本
要执行此操作,您只需cd
进入Rails应用程序的工作目录,然后运行:
gem update bundler
这将在您的应用中安装最新版本的bundler
gem,这也应该用于解决您也会看到的错误