Rails on Azure app service: "Could not find 'bundler' (2.1.4)" - ruby-on-rails

I'm trying to deploy my Ruby 2.6.2 with Rails 6.0.3.4 and I'm getting GemNotFoundException with Bundler:
Running bundle check
`find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/site/wwwroot>/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
Running 'gem list bundler' on my local machine returns, I remove the defualt version.
bundler (2.1.4)
I've tried updating gem and it's 3.1.4.
I'm pretty sure I'm correctly pushing it to Azure, as I made a new app service and pushed my Rails app with bundler 2.1.4 and I've tried restarting the VM.
Quite new to Azure, so am pretty stuck on this.

Related

Can't make successful deploy to Beanstalk

I'm using the eb CLI to deploy my RoR API to Beanstalk, and although the deploy works, the app degrated. I can see that it fails with:
+ bundle install
/opt/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/rubygems.rb:284:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /var/app/ondeck/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
from /opt/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/rubygems.rb:303:in `activate_bin_path'
from /opt/rubies/ruby-2.5.7/bin/bundle:23:in `<main>'.
I'm not finding in the AWS docs what I should do to fix this and prevent from happening again. Has anyone experienced the same, or knows why it's happening, and more important, how to fix it.
The bundler version of your elastic beanstalk is not 2.1.4 which is required by your project. Add an elastic beanstalk config file to upgrade the pre-installed bundler of elastic beanstalk.
#.ebextensions/bundler_update.config
commands:
update_bundler:
command: /opt/rubies/ruby-2.5.7/bin/gem install bundler -v 2.1.4
Ruby and Bundler version should match yours.

Ruby on rails new app is not creating

I started to develop the new RoR web app and faced weird issue.
I wanted to create new app with Postgresql. So I installed the Postgres with brew and MacOS desktop app. And type rails new test-app --database=postgresql.
At this moment, I can't install bundles because there is certain
error.
An error occurred while installing pg (1.0.0), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.0.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
run bundle exec spring binstub --all
Could not find gem 'pg (< 2.0, >= 0.18)' in any of the gem sources
listed in your Gemfile.
Run `bundle install` to install missing gems.
So I can't start new app.
Is this an issue that is occurring because of the mismatch between ruby and postgres version?
And how can I create new app with postgres?
I am currently using Mac OS high Sierra, postgres 10.5, rails 5.2.1
Try to skip running Bundler: rails new test-app --database=postgresql --skip-bundle
Once you've generated your app, you'll still have to troubleshoot why pg ins't installing. The PG gem should install just fine as long as the database is there and your system can build the gem's native extensions, so my first guess is either Postgres isn't installed or it can't be found in your environment.
Either way, this does answer your question. Skip the bundle and voila - Rails will generate a new clean app for you.
I've posted some comments, but i already seen that it seems to be an error when installing postgresql via brew. It's not common, but it happens sometimes.
Here's a quick fix:
brew install libpqxx
Make sure to run also
brew update
and restart your PostgreSQL server via:
brew services restart postgresql
Also make sure to clean up brew:
brew cleanup
If the error is still there, post your Gemfile and your database.yml file as well.
Greetings!

Heroku and bundler version

I'm pushing code on Heroku as usual.
But this message appear :
Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.1). We suggest you upgrade to
the latest version of Bundler by running gem install bundler.
So I run:
heroku run gem install bundler
Running gem install bundler on ⬢ myapp... up, run.3401
(Standard-1X)
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 11 seconds
1 gem installed
But when I retry to push code:
heroku run bundle install
Running bundle install on ⬢ myapp... up, run.9532 (Standard-1X)
Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.1). We suggest you upgrade to
the latest version of Bundler by running gem install bundler.
In the gem Gemfile.lock I got:
BUNDLED WITH
1.16.1
I don't understand why this bundler release doesn't want to be install on Heroku.
Bundler 1.15.2 is the version that is pre-installed on Heroku dynos. Changing Bundler to 1.16.1 on your machine doesn't change the version installed on Heroku.
Furthermore, you cannot update Bundler on Heroku by running bundle install. And even if that was possible it would take effect on the next run of Bundler - and usually, you only bundle once on a Heroku dyno.
My advice is: It is just a warning, just ignore it and let's hope that Heroku updates Bundler more ofter in the future.
You also want to make sure you're using a standard Heroku buildpack for this.
When I attempted to upgrade my app from Cedar to Heroku-20, it kept failing with this same bundler error. But, eventually, I remembered that I had install a custom buildback and that turned out to be the source of the incorrect bundler version.
Once I switched back to the default Heroku Ruby buildpack, I was finally able to deploy without any issues.

What does "Your bundle is locked to addressable " mean?

I'm trying to bundle exec jekyll serve
but I get this error:
Your bundle is locked to addressable (2.5.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of addressable (2.5.0) has removed it. You'll need to update your bundle to a different version of addressable (2.5.0) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
bundle install gives me
Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
This works, but it gives me the wrong version I think:
Successfully installed bundler-1.15.1
Parsing documentation for bundler-1.15.1
Done installing documentation for bundler after 4 seconds
1 gem installed
Where is the bundle locked to adressable and what does this mean? I checked my gemfile, it's nothing in there. Can I unlock it? I'm trying to run a boilerplate for jekyll and installed ruby using brew.
The "Your bundle is locked to addressable..." error just means that you have a version of addressable specified in your Gemfile.lock, but it's not installed on your machine (yet). Running bundle install fixes that.
As such, if you run the following, your app should run just fine:
$ bundle install
$ bundle exec jekyll serve
The "Bundler (1.13.6) is older..." warning is just an FYI from the good people at Bundler, encouraging you to upgrade. You can safely ignore it without it affecting your app (but it's good practice to stay up-to-date).

Rails server is not starting

I installed Ruby on Rails in my Windows 8 machine and created a project. When I tried to run the application, it gives this error:
Could not find gem 'sass-rails (~> 4.0.2) x64-mingw32' in the gems available on
this machine.
Run bundle install to install missing gems.
I reinstalled the gem files and ran bundle install but received the same result.
How can I fix this?

Resources