简体   繁体   English

Ruby on Rails捆绑安装无法正常工作

[英]Ruby on Rails Bundle Install Not working

So I am currently learning Ruby on Rails using Michael Hartl tutorial (really noob at the moment - really new to programming). 因此,我目前正在使用Michael Hartl教程学习Ruby on Rails(目前还真是个菜鸟-对编程来说真的很新)。 I have tried to edit the gemfiles in the "hello_app" that I am making - as told to do so by Michael, however when I go back into Terminal to run the bundle install - I get the following rather than it installing: 我曾尝试编辑正在制作的“ hello_app”中的gemfiles(正如Michael所指示的那样进行编辑),但是当我回到Terminal运行捆绑安装时,会得到以下内容,而不是安装它:

Abduls-MacBook-Pro:hello_app Monahim$ bundle install

[!] There was an error parsing `Gemfile`: unexpected fraction part after numeric literal -   gem 'sqlite3' , 1.3.12
                 ^
/Users/Monahim/railsmhartl/hello_app/Gemfile:40: syntax error, unexpected tIDENTIFIER, expecting keyword_end
gem 'byebug', '9.0.0' platform: :mri, end
                            ^
/Users/Monahim/railsmhartl/hello_app/Gemfile:55: syntax error, unexpected end-of-input, expecting keyword_end. Bundler cannot continue.

 #  from /Users/Monahim/railsmhartl/hello_app/Gemfile:38
 #  -------------------------------------------
 #  group :development, :test do
 >    gem 'sqlite3' , 1.3.12
#    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
 #  -------------------------------------------
Abduls-MacBook-Pro:hello_app Monahim$ 

Can someone please let me know what is going on? 有人可以让我知道发生了什么吗? And how do I fix it? 我该如何解决? Here's what I have in my Atom Text Editor: 这是我的Atom文本编辑器中的内容:

source 'http://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "ht//githublinkhere /#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record

# Use Puma as the app server
gem 'puma', '~> 3.4.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 3.0.0'
# See /githubrailsreadmelinkhere for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
gem 'jquery-rails', '4.1.1'
# Turbolinks makes navigating your web application faster. Read more:          /githubturbolinkhere
gem 'turbolinks', '~> 5.0.1'
# Build JSON APIs with ease. Read more: linktojbuilder
gem 'jbuilder', '~> 2.4.1'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

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

group :development, :test do
  gem 'sqlite3' , 1.3.12
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', '9.0.0' platform: :mri, 
end
# Adds support for Capybara system testing and selenium driver

group :development do
  # Access an IRB console on exception pages or by using <%= console %>   anywhere in the code.
  gem 'web-console', '>= 3.1.1'
  gem 'listen', '>= 3.0.5', '< 3.0.8'
  # Spring speeds up development by keeping your application running in the background. Read more: /github.com/railsspringlinkhere
  gem 'spring' , '1.7.2.'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Thank you very much for going through this.Please do explain what os going on so I learn as well as correcting the errors. 非常感谢您完成此操作。请务必说明操作系统的运行状况,以便我学习并纠正错误。 Obviously you can tell I am really, really new to this game but am eager to learn! 显然,您可以告诉我这个游戏真的很新,但是很想学习!

Please advise, Thanks! 请指教,谢谢!

There are two typos/errors in the group :development, :test from your Gemfile : Gemfile中的group :development, :test有两种错别字/错误:

  1. You are missing quotes (or double quotes) in your sqlite3 gem version: 您的sqlite3 gem版本中缺少引号(或双引号):

     gem 'sqlite3' , 1.3.12 ^ ^ 
  2. There is a missing and trailing comma , in gem 'byebug' 存在丢失和尾随逗号,gem 'byebug'

     gem 'byebug', '9.0.0' platform: :mri, ^ ^ 

So group :development, :test should look like this: 所以group :development, :test应该看起来像这样:

group :development, :test do
  gem 'sqlite3', '1.3.12'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', '9.0.0', platform: :mri 
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM