我完全是noob,并且从头开始学习Ruby on Rails Book One。我已经卡住了几次,但是我已经通过google,stackoverflow等解决了这个问题......(我不想成为一个负担)但是我无法忍受。 我在Gemfile"章节"。首先,我只是试图复制书中的确切内容:
source 'https://rubygems.org' ruby '2.0.0'
gem 'rails', '4.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0' gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors' gem 'quiet_assets' gem 'rails_layout'
end
这给了我这个结果:
[!] There was an error parsing `Gemfile`: syntax error, unexpected tIDENTIFIER, expecting gem 'rails', '4.0.1'...https://rubygems.org' ruby '2.0.0'
... ^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:1
# -------------------------------------------
end 'better_errors' gem 'quiet_assets' gem 'rails_layout'
然后我尝试更改了一些类似于版本等的内容,如下所示:
source 'https://rubygems.org'
ruby ’2.3.3’
gem 'rails', ’5.0.1’
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0’
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2’
gem 'jquery-rails'
gem 'turbolinks’
gem 'jbuilder', '~> 2.5’
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
gem 'quiet_assets'
gem 'rails_layout'
end
这给了我这个结果:
[!] There was an error parsing `Gemfile`: no .<digit> floating literal anymore; put 0 before dot - ruby ’2.3.3’
^
/Users/MYUSERNAME/Projects/learn-rails/Gemfile:2: syntax error, unexpected tFLOAT, expecting '('
ruby ’2.3.3’
^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:2
# -------------------------------------------
# source 'https://rubygems.org'
> ruby ’2.3.3’
# gem 'rails', ’5.0.1’
# -------------------------------------------
我尝试了一些我在搜索时发现的东西,比如改变&#39;到&#34;在ruby版本上,放置一个0.2.3.3&#39;或只是&#39; .2.3.3&#39;,进行捆绑更新等。我不知道&#34;没有。莲花...&#34;手段?或者&#34;期待&#39;(&#39;&#34;是什么?
我真的已经搜索并尝试了各种解决方案(得到了4-5个不同的保存&#34; Gemfile&#34;尝试我在网上找到的任何内容)。 对不起,如果这只是占用了互联网的空间,但我只是没有得到它。如果原版(来自书中)甚至不起作用,为什么它甚至在那里?
(我在这里只更改了我的个人姓名,因为它是我的完整,实际的名字,也许我是偏执狂,但可能也是如此。所以这不是错误)
谢谢, Ethonrails
答案 0 :(得分:2)
确保您使用'
而非’
它是一种不同类型的撇号。 (Gemfile中的任何地方,我都会看到几个实例ruby ’2.3.3’
,gem 'sass-rails', '~> 5.0’
)
以下是适用的Gemfile版本:
source 'https://rubygems.org'
ruby '2.3.3'
gem 'rails', '5.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.5'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
# gem 'quiet_assets' (not compatible with rails 5 atm)
gem 'rails_layout'
end
提示:尝试使用带有Ruby语法高亮的代码编辑器,这样可以更容易发现未来的语法错误。
答案 1 :(得分:1)
尝试将`字符替换为'
答案 2 :(得分:1)
而不是返回引号(`),在Gemfile中使用单引号(')。
当您在轨道上学习ruby时,我想建议这个可能对您有用的链接,http://guides.rubyonrails.org/getting_started.html