Could not find nokogiri-1.11.1 in any of the sources while deploying a heroku app

Viewed 2329

my first post here! I am getting a "Could not find nokogiri-1.11.1 in any of the sources" error while deploying my Rails app to Heroku. After successfully pushing the app to my git repository, I receive the error when I run "git push heroku master". My ruby version is 2.7.2, rails is 6.1.3 and the bundler version is 2.1.4. Thank you!

remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        The git source `git://github.com/rightscale/right_http_connection.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config set git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
remote:        Some gems seem to be missing from your vendor/cache directory.
remote:        Could not find nokogiri-1.11.1 in any of the sources
remote:        Bundler Output: The git source `git://github.com/rightscale/right_http_connection.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config set git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
remote:        Some gems seem to be missing from your vendor/cache directory.
remote:        Could not find nokogiri-1.11.1 in any of the sources
.
.
.
    remote:  !     Failed to install gems via Bundler.
.
.
.
! [remote rejected] master -> master (pre-receive hook declined)
1 Answers

This is a known issue with Nokogiri due to the Bundler's default behavior is to cache only gems for the development system and not the production system, leading to an error at deploy time.

This may solve your error.

rm -rf vendor/cache
bundle config set force_ruby_platform true
bundle install

You can find more information here.

Related