My rails application runs using a docker and everytime I try to execute any ‘bin/rails’ commands in the terminal of the docker container, it raises the following error
Could not find racc-1.6.0 in any of the sources
Run `bundle install` to install missing gems.
on executing ‘gem list’ I have checked that racc is installed as ‘racc (1.6.0 default: 1.5.1)’ and calling ‘bundle install’ as the app suggest raises the same error. I assumed that maybe the ‘default: 1.5.1’ is the problem but did not manage to come around this one so far. Also executing ‘which racc’ or ‘bundle info racc’ returns the correct version of racc which is 1.6.0.
Update:
an exception is ‘bin/rails server’ which means the application launches like usual but I cannot do migrations and console calls.
Trying to use other racc version did not do any better since using 1.5.2 raises the same error and 1.5.1 requires nokogiri-linux which I did not manage to install locally so far
2
Answers
So, after trying a bunch of commands and re-deploying the image I figured out that in the end creating a new project would solve most of the issues. Unfortunately, I still did not find out the cause of this problem but I assume there might have been conflicts in the configuration or general problems in the project setting. So heres the solution summed up
Solution 1:
bin/rails console
(optional)Solution 2:
.bundle
folder, delete it to prevent rails app from reading gems invendor/cache
. Checkbundle info <gem-name>
to see if gem path is set on the correct gem-directoryProbably not a solution for all cause but this was my last option to try when everything else failed
please try “docker-compose run web bundle install” command. This should work