'rails s LoadError: cannot load such file -- refile/simple_form
- I am having an issue with when I run rails s. I am working on a legacy application and attempting to upgrade to the latest versions of rails and ruby. Current application is using ruby 2.5.0 and rails 5.2.8. The issue is centered around the following:
/Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in require': cannot load such file -- refile/simple_form (LoadError)
- When I run
bundle installit is successful rendering the following results:
Bundle complete! 43 Gemfile dependencies, 150 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
1 installed gem you directly depend on is looking for funding.
Run bundle fund for details
- When I run
bundle fundI get the following:
cancancan (3.3.0) Funding: https://github.com/sponsors/coorasse
- I then at
cancancan (3.3.0)to my gemfile and runbundle installagain which results successfully. I try to runrails sand I continue to get the same error. Any help would be greatly appreciated.
I even tried to set thegem refiletogem 'refile', require: ['refile/rails', 'refile/simple_form']. This does not make a difference.
Current Error after running rails s
user@user-2 project_001 % rails s
=> Booting Puma
=> Rails 5.2.8 application starting in development
=> Run rails server -h for more startup options
Exiting
Traceback (most recent call last):
61: from bin/rails:4:in <main>'
60: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require'
59: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require'
58: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands.rb:18:in <top (required)>'
57: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/command.rb:46:in invoke'
56: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/command/base.rb:69:in perform'
55: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.2.1/lib/thor.rb:392:in dispatch'
54: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in invoke_command'
53: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.2.1/lib/thor/command.rb:27:in run'
52: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:142:in perform'
51: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:142:in tap'
50: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:147:in block in perform'
49: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:51:in start'
48: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:89:in log_to_stdout'
47: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:422:in wrapped_app'
46: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:27:in app'
45: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:249:in app'
44: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/server.rb:349:in build_app_and_options_from_config'
43: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in parse_file'
42: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in load_file'
41: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in new_from_string'
40: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in eval'
39: from config.ru:3:in block in <main>'
38: from config.ru:3:in require_relative'
37: from /Users/user/Documents/GitHub/Alaska-Project/project_001/config/environment.rb:5:in <top (required)>'
36: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/application.rb:361:in initialize!'
35: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:60:in run_initializers'
34: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:205:in tsort_each'
33: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:226:in tsort_each'
32: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in each_strongly_connected_component'
31: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in call'
30: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in each'
29: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:349:in block in each_strongly_connected_component'
28: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:415:in each_strongly_connected_component_from'
27: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:415:in call'
26: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:50:in tsort_each_child'
25: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:50:in each'
24: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:421:in block in each_strongly_connected_component_from'
23: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:431:in each_strongly_connected_component_from'
22: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:422:in block (2 levels) in each_strongly_connected_component_from'
21: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
20: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:228:in block in tsort_each'
19: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:61:in block in run_initializers'
18: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:32:in run'
17: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/initializable.rb:32:in instance_exec'
16: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/engine.rb:619:in block in <class:Engine>'
15: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/engine.rb:619:in each'
14: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/engine.rb:620:in block (2 levels) in <class:Engine>'
13: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/engine.rb:662:in load_config_initializer'
12: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/notifications.rb:170:in instrument'
11: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.2.8/lib/rails/engine.rb:663:in block in load_config_initializer'
10: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:285:in load'
9: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:257:in load_dependency'
8: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:285:in block in load'
7: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in load'
6: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in load'
5: from /Users/user/Documents/GitHub/Alaska-Project/project_001/config/initializers/simple_form.rb:2:in <top (required)>'
4: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:291:in require'
3: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:257:in load_dependency'
2: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.8/lib/active_support/dependencies.rb:291:in block in require'
1: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in require'
/Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in require': cannot load such file -- refile/simple_form (LoadError)
Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'next_rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.8'
# Use postgresql as the database for Active Record
# gem 'pg', '0.18.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.12.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
gem 'redis'#, '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.11.1', 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
# Use debugger
# gem 'debugger', group: [:development, :test]
gem "haml"
gem "omniauth"
gem "omniauth-github"
gem "omniauth-google-oauth2", '~> 0.8.0'
gem "omniauth-openid"
gem "google-api-client"
gem 'cancancan', '~> 3.3'
gem 'bootstrap_form'
gem 'friendly_id'#, '~> 5.0.0'
# gem 'ransack'
# gem 'rdiscount', require: 'tilt/rdiscount'
gem 'ruby_identicon'
gem 'sidekiq'
gem "refile", require: "refile/rails"
# gem "refile-mini_magick"
gem 'simple_form'
gem 'active_link_to'
gem 'chartkick', '~> 3.4', '>= 3.4.2' #gem 'chartkick'
gem 'groupdate'
gem 'faker'
# gem 'skylight'
gem 'bundler', '>= 2.0.0.pre.3' #'~> 2.3'#, '>= 2.0.0.pre3' #,
gem 'bootstrap-sass', '~> 3.4.1'
gem 'sassc-rails', '>= 2.1.0'
gem "font-awesome-rails"
# bring back removed support for respond_with
# gem 'responders', '~> 2.0'
group :production do
gem 'rails_12factor'
# gem 'puma'
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'
# Listens to file modifications and notifies you about the changes
gem 'listen' #, '>= 3.0.5', '< 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'
# gem 'guard'
# gem 'guard-minitest'
gem 'better_errors'
# gem 'binding_of_caller'
# gem 'quiet_assets'
# gem 'pry-rails'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara' #, '>= 2.15', '< 4.0'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
ruby "2.5.0"
simple_form.rb
# Use this setup block to configure all options available in SimpleForm.
require 'refile/simple_form'
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
b.optional :maxlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# Use :to_sentence to list all errors for each field.
# config.error_method = :first
# Default tag used for error notification helper.
config.error_notification_tag = :div
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'
# ID to add for error notification helper.
# config.error_notification_id = nil
# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
# Series of attempts to detect a default value method for collection.
# config.collection_value_methods = [ :id, :to_s ]
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
# You can define the class to use on all collection wrappers. Defaulting to none.
# config.collection_wrapper_class = nil
# You can wrap each item in a collection of radio/check boxes with a tag,
# defaulting to :span.
# config.item_wrapper_tag = :span
# You can define a class to use in all item wrappers. Defaulting to none.
# config.item_wrapper_class = nil
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the default class to be used on forms. Can be overriden
# with `html: { :class }`. Defaulting to none.
# config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
# These validations are enabled in SimpleForm's internal config but disabled by default
# in this configuration, which is recommended due to some quirks from different browsers.
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
# change this configuration to true.
config.browser_validations = false
# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
# config.input_mappings = { /count/ => :integer }
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
# Namespaces where SimpleForm should look for custom input classes that
# override default inputs.
# config.custom_inputs_namespaces << "CustomInputs"
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
# Default priority for country inputs.
# config.country_priority = nil
# When false, do not use translations for labels.
# config.translate_labels = true
# Automatically discover new inputs in Rails' autoload path.
# config.inputs_discovery = true
# Cache SimpleForm inputs discovery
# config.cache_discovery = !Rails.env.development?
# Default class for inputs
# config.input_class = nil
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
# config.include_default_input_wrapper_class = true
# Defines which i18n scope will be used in Simple Form.
# config.i18n_scope = 'simple_form'
end
Solution 1:[1]
The gem for the missing resource is commented out in your Gemfile:
# gem 'refile', require: 'refile/simple_form'
Also, make sure that the version of refile being installed is at least 0.6.0 (i.e., the version where simple_form support was introduced.) Sometimes conflicts cause bundler to go back to refile 0.3.0.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
