У меня была проблема с версией downgrade rails в моем новом проекте ( После возникновения конфликта версий Chage Rails. Bundler не смог найти совместимые версии для gem ).
Теперь я думаю, что версия rails проекта удалена и изменена на 5.1.0. Однако команда "bin / rails s" не работает и не может запустить сервер rails.
1: перед сменой рельсов с версии 5.2.2 на 5.1.0 команда «bin / rails s»
работал.
2: «bin / rails -v» дает Rails 5.1.0
3: «bin / rails s» выдает ошибку ниже.
Traceback (most recent call last):
30: from bin/rails:4:in `<main>'
29: from
/Users/username/project/vendor/bundle/ruby/2.5.0/gems/activesupport-
5.1.0/lib/active_support/dependencies.rb:292:in `require'
28: from
/Users/username/project/vendor/bundle/ruby/2.5.0/gems/activesupport-
5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
27: from
/Users/username/project/vendor/bundle/ruby/2.5.0/gems/activesupport-
5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
26: from
/Users/username/project/vendor/bundle/ruby/2.5.0/gems/bootsnap-
1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in
`require'
.
.
.
.
58:in `load_dependency'
1: from /Users/username/project
/vendor/bundle/ruby/2.5.0/gems/activesupport-
5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
/Users/username/project/vendor/bundle/ruby/2.5.0/gems/bootsnap-
1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
`require': cannot load such file -- active_storage/engine
(LoadError)
gemfile
ruby '2.5.1'
gem 'rails', '5.1.0'
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
application.rb
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Project
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails
version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over those
specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after
loading
# the framework and any gems in your application.
# Don't generate system test files.
config.generators.system_tests = nil
end
end