I'm currently working on a Rails application within docker. When trying to install Rspec by running docker-compose run web rails generate rspec:install I get the following error.
Could not find rake-12.3.2 in any of the sources
Run `bundle install` to install missing gems.
I tried docker-compose run web bundle update rake
In my Gemfile.lock I see version 12.3.2 However when I run docker-compose run we gem list I see version 12.3.1
I don't see to know where the issue is coming from. Since Gemfile and Gemfile.lock have the right version of bundler.
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Loads environment variables from `.env`.
gem 'dotenv-rails', groups: %i[development test production]
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Interact with Box API via Boxr Ruby library.
gem 'boxr'
# PDF merger
gem 'combine_pdf', '~> 1.0', '>= 1.0.14'
# PDF parse into form
gem 'pdf-forms', '~> 1.1', '>= 1.1.1'
# Add PNG, JPEG and Other images to PDF
gem 'prawn', '~> 2.1'
# Use httparty for requests
gem 'httparty', '~> 0.16.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
gem 'byebug', platforms: %i[mri mingw x64_mingw]
end
group :development do
gem 'pry-rails'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'web-console', '>= 3.3.0'
# Spring speeds up development by keeping your application running
# in the background. Read more: https://github.com/rails/spring
gem 'rubocop', '~> 0.59.1', require: false
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', '< 4.0'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
gem 'rspec-rails', '~> 3.8', '>= 3.8.2'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
Here is the Gemfile.lock file:
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.2)
actionpack (= 5.2.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.2)
actionview (= 5.2.2)
activesupport (= 5.2.2)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.2)
activesupport (= 5.2.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.2)
activesupport (= 5.2.2)
globalid (>= 0.3.6)
activemodel (5.2.2)
activesupport (= 5.2.2)
activerecord (5.2.2)
activemodel (= 5.2.2)
activesupport (= 5.2.2)
arel (>= 9.0)
activestorage (5.2.2)
actionpack (= 5.2.2)
activerecord (= 5.2.2)
marcel (~> 0.3.1)
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (9.0.0)
ast (2.4.0)
bindex (0.5.0)
bootsnap (1.3.2)
msgpack (~> 1.0)
boxr (1.4.0)
addressable (~> 2.3)
hashie (~> 3.5)
httpclient (~> 2.8)
jwt (~> 1.4)
builder (3.2.3)
byebug (10.0.2)
capybara (3.13.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (2.1.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
cliver (0.3.2)
coderay (1.1.2)
combine_pdf (1.0.15)
ruby-rc4 (>= 0.1.5)
concurrent-ruby (1.1.4)
crass (1.0.4)
diff-lcs (1.3)
dotenv (2.6.0)
dotenv-rails (2.6.0)
dotenv (= 2.6.0)
railties (>= 3.2, < 6.0)
erubi (1.8.0)
ffi (1.10.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
hashie (3.6.0)
httparty (0.16.3)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
httpclient (2.8.3)
i18n (1.5.3)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jaro_winkler (1.5.2)
jwt (1.5.6)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
msgpack (1.2.6)
multi_xml (0.6.0)
nio4r (2.3.1)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
parallel (1.13.0)
parser (2.6.0.0)
ast (~> 2.4.0)
pdf-core (0.7.0)
pdf-forms (1.2.0)
cliver (~> 0.3.2)
safe_shell (>= 1.0.3, < 2.0)
powerpack (0.1.2)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.0.3)
puma (3.12.0)
rack (2.0.6)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.2)
actioncable (= 5.2.2)
actionmailer (= 5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
activemodel (= 5.2.2)
activerecord (= 5.2.2)
activestorage (= 5.2.2)
activesupport (= 5.2.2)
bundler (>= 1.3.0)
railties (= 5.2.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.2)
actionpack (= 5.2.2)
activesupport (= 5.2.2)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
regexp_parser (1.3.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.59.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.0)
ruby-rc4 (0.1.5)
ruby_dep (1.5.0)
rubyzip (1.2.2)
safe_shell (1.1.0)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.20.3)
thread_safe (0.3.6)
ttfunk (1.5.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
DEPENDENCIES
bootsnap (>= 1.1.0)
boxr
byebug
capybara (>= 2.15, < 4.0)
chromedriver-helper
combine_pdf (~> 1.0, >= 1.0.14)
dotenv-rails
httparty (~> 0.16.2)
listen (>= 3.0.5, < 3.2)
pdf-forms (~> 1.1, >= 1.1.1)
prawn (~> 2.1)
pry-rails
puma (~> 3.11)
rails (~> 5.2.0)
rspec-rails (~> 3.8, >= 3.8.2)
rubocop (~> 0.59.1)
selenium-webdriver
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data
web-console (>= 3.3.0)
RUBY VERSION
ruby 2.5.3p105
BUNDLED WITH
1.17.2
Also, my Dockerfile
FROM ruby:2.5-alpine
# Bare minimum dependencies for our Rails App with the Apline image;
# build-base, git, nodejs, linux-headers, postgresql-dev, tzdata
#
# Project dependencies include;
# pdftk
RUN apk add --no-cache --update \
bash \
build-base \
git \
nodejs \
pdftk \
postgresql-dev \
tzdata \
less
# Set the working directory for all commands after this
WORKDIR /app
# Bundle the application
# Copy our Gemfiles into the app directory and install
ADD ./rails_app/Gemfile \
./rails_app/Gemfile.lock \
/app/
RUN bundle install
and my docker-compose .yml file:
version: '3'
services:
web:
image: onlineapps:0.0.1
build: .
# Remove the server.pid if it exists and then start the rails app on port 3000
command: bash -c "rm -f /app/tmp/pids/server.pid && bundle install && bundle exec rails s -p 3000 -b '0.0.0.0'"
# Mount our files to the app directory to detect changes
volumes:
- ./rails_app:/app
restart: always
ports:
- "3000:3000"
tty: true
stdin_open: true
if I run docker-compose run web bundle install --deployment I get the following error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /app/vendor/bundle/ruby/2.5.0/gems/msgpack-1.2.6/ext/msgpack
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.5.0 -r ./siteconf20190131-1-49a1tv.rb extconf.rb
/usr/local/lib/ruby/2.5.0/mkmf.rb:227:in `expand_path': No such file or directory - getcwd (Errno::ENOENT)
from /usr/local/lib/ruby/2.5.0/mkmf.rb:227:in `<module:MakeMakefile>'
from /usr/local/lib/ruby/2.5.0/mkmf.rb:48:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from extconf.rb:1:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /app/vendor/bundle/ruby/2.5.0/gems/msgpack-1.2.6 for inspection.
Results logged to /app/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/msgpack-1.2.6/gem_make.out
An error occurred while installing msgpack (1.2.6), and Bundler cannot continue.
Make sure that `gem install msgpack -v '1.2.6' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
bootsnap was resolved to 1.3.2, which depends on
msgpack
After installing msgpack it still doesn't update. Whats wrong?
Thanks for posting all your files, makes it easier to help ;) I could not reproduce your problem, it fetched rake 12.3.2.
My suggestion:
It fetched rake 12.3.2 every time I ran the above. I think there may have been a previous instance of the rake gem installed in your image. You could try fixing things with
bundle update, but in the end the goal is to correctly build things from scratch.