What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec

[Rails] What to do when ‘Could not find’ in any of the sources appears in the Docker × Rails × RSpec development environment

Gemfile


group :development, :test do
  ~Added below~
  gem 'rspec-rails'
  gem 'factory_bot_rails'
end

I updated the Gemfile, so run bundle install with the docker command

$ docker-compose run web bundle exec rails g rspec:install

Error message

Could not find diff-lcs-1.4.4 in any of the sources
Run `bundle install` to install missing gems.

I tried to refer to various articles and tried it, but it didn't work ...

Solutions

Is there a case where bundle install is not executed in the cache while googled variously? I saw the article, and immediately executed it

$ docker-compose build --no-cache

Execution result

$ docker-compose run web bundle exec rails g rspec:install
Creating app_run ... done
Running via Spring preloader in process 64
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
      create  spec/rails_helper.rb

Successful creation

Cause

Even if docker-compose build is done, cache is enabled and the setting change is reflected and it may not work well, so when updating Gemfile during development

$ docker-compose build --no-cache

It is better to execute with

Summary

The point is that it took a long time to resolve because there were many articles related to spring stop. But I also felt that this accumulation was important because I was a beginner.

reference

I referred to the following article! Thank you very much!

Solution for bundle install not in container with Docker Build docker without using cache

Recommended Posts

What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do if Could not find hoge in any of the sources Run `bundle install` to install missing gems. Appears in the docker container
What to do when a could not find driver appears when connecting to a DB in a Docker environment
[Rails & Docker & MySQL environment construction] Could not find gem ‘mysql2 (> = 0.4.4, <0.6.0)’ in any of the gem sources listed in your Gemfile.
What to do when Rails on Docker does not reflect controller changes in the browser
What I did when I was addicted to the error "Could not find XXX in any of the sources" when I added a Gem and built it
[Programming beginner] What to do when rails s becomes an error in the local development environment
What to do when rails db: seed does not reflect in the database
Could not find coderay-1.1.3 in any of the sources (Bundler :: GemNotFound) during co-development
What to do when routing settings do not work after building Docker environment with Laravel
What to do when the changes in the Servlet are not reflected
What to do when "relation" hibernate_sequence "does not exist" in the ID column of PostgreSQL + JPA
What I was addicted to when updating the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do if the app is not created with the latest Rails version installed when rails new
How to execute with commands of normal development language in Docker development environment
What to do when Blocked Host: "host name" appears in Ruby on Rails
When composer install/require in the Docker container, it becomes `Could not find package`
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
Docker the development environment of Ruby on Rails project
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
SSL in the local environment of Docker / Rails / puma
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
What to do if Failure / Error: require File.expand_path ('../ config / environment', __dir__) appears in RSpec
[Rough explanation] How to separate the operation of the production environment and the development environment with Rails
How to deal with errors in Rails s could not find a JavaScript runtime.
About the solution of the error that occurred when trying to create a Japanese file of devise in the Docker development environment
What to do if you get an error saying "Could not find a JavaScript runtime." When starting rails server
What to do when Method not found in f: ajax
What to do when you launch an application with rails
How to build Rails, Postgres, ElasticSearch development environment with Docker
One of the causes and solutions when whales do not appear in Docker Quickstart Terminal
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
[Rails] What to do when the view collapses when a message is displayed with the errors method
[Rails] What to do if data is not registered in DB
I tried to build the environment of PlantUML Server with Docker
Super beginner builds Rails6 + Postgresql environment with Docker to the end
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
How to install Pry after building Rails development environment with Docker
What to do if Cloud9 is full in the Rails tutorial
[Rails] What to do when rails s does not respond or does not stop
What to do when javax.el.ELException: Not a Valid Method Expression: appears when the JSF screen is displayed
[RSpec] When you want to use the instance variable of the controller in the test [assigns is not recommended]
What to do if Operation not permitted is displayed when you execute a command in the terminal
[IOS] What to do when the image is filled with one color
What to do if the prefix c is not bound in JSP
Problems I was addicted to when building the digdag environment with docker
I tried to build a Firebase application development environment with Docker in 2020
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to find the total number of pages when paging in Java
How to constrain the action of the transition destination when not logged in
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
[Rails] The cause of not being able to post was in form_with
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
How to build Rails 6 environment with Docker
What to do if you have enabled Use the WSL2 based engine in Docker Desktop with insufficient WSL2 installation
[Rails] I want to reset everything because the data in the local environment is strange! What to do before that
What to do if the changes are not reflected in the jar manifest file
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator