Error installing Ubuntu 18.10 - Failed to build gem native extension

I searched the forums but didn’t find this error. Others with the same or similar error message had very different error details. This is my first attempt to install middleman on my localhost. Here are the steps I followed. This was based on a very old set of commands posted online:

  1. sudo apt install ruby-dev
  2. sudo apt install gem
  3. sudo gem install middleman
    Here is the error detail:
ERROR:  Error installing middleman:
	ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.5.0/gems/sassc-2.0.1/ext/usr/bin/ruby2.5 -rrubygems /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake RUBYARCHDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/sassc-2.0.1 RUBYLIBDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/sassc-2.0.1
/usr/bin/ruby2.5: No such file or directory -- /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake (LoadError)

rake failed, exit code 1

The directory indicated in green does, in fact, not exist. Actually there is no
gems directory in
/usr/share/rubygems-integration/all/

I have no idea how it should have been created.
If it’s of any importance, rake itself is installed:

>rake --version
>rake, version 12.3.1

Any suggestions?

I don’t have first-hand experience of this issue, but it looks as if other Ubuntu users may have encountered similar problem with other packages. This page:

https://github.com/Shopify/mruby-engine/issues/33

contains various suggested solutions to what might be a related issue. Worth trying them to see if they help?