[英]Error message when trying to run the command: bundle install --without production
[英]I'm trying to run Bundle Install, what does this error message mean?
感谢您抽出时间来阅读。 我对此非常陌生,目前正在学习Rails的教科书,如果我学得慢,请道歉。 我目前正在阅读 Ruby on Rails 教程(第 3 版)的第 5 章,这部分是我的错,因为我摆弄了一些东西(我不确定是什么),现在我收到了这个错误:我正在尝试安装 Bootstrap,我应该在我的 gemfile 中添加一行代码。 但是现在每次我尝试运行bundle install时,都会收到此错误。
[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice with different version requirements.
You specified: rails (= 4.2.2) and rails (~> 6.0.3, >= 6.0.3.1). Bundler cannot continue.
# from /home/ubuntu/environment/sample_app/Gemfile:10
# -------------------------------------------
# # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
> gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
# # Use sqlite3 as the database for Active Record
# -------------------------------------------
我知道这可能是一些基本而明显的事情,但我会很感激明确的指导,因为我完全迷失了。 任何和所有帮助表示赞赏:这就是我的 Gemfile 的样子:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'bootstrap-sass', '3.2.0.0'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '> = 4.1.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
正如错误消息所说,您有几个关于rails
gem 的声明。
删除gem 'rails', '4.2.2'
(在文件顶部,在source 'https://rubygems.org'
之后)并运行bundle install
(或只是bundle
)。
希望这可以帮助!
Rails 在您的 Gemfile 中定义了两次。
第一个在第 3 行,第二个在第 10 行。 只需从第 3 行中删除第一个并再次尝试bundle install
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.