Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku fails during build with Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)

Ruby 2.7.4 Rails 6.1.4.1

note: in package.json the engines key is missing in my app

Heroku fails during build with this error

this commit is an empty commit on top of exactly a SHA that I was successful at pushing yesterday (I've checked twice now) so I suspect this is a platform problem or somehow the node-sass got deprecated or yanked yesterday?

how can I fix this?

remote:        
remote:        ERROR in ./app/javascript/require_bootstrap.scss
remote:        Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
remote:        ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
**remote:        Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)**
remote:        For more information on which environments are supported please see:
remote:        https://github.com/sass/node-sass/releases/tag/v4.14.1
remote:            at module.exports (/tmp/build_1c436dcf/node_modules/node-sass/lib/binding.js:13:13)
remote:            at Object.<anonymous> (/tmp/build_1c436dcf/node_modules/node-sass/lib/index.js:14:35)
remote:            at Module._compile (/tmp/build_1c436dcf/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
remote:            at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

like image 758
Jason FB Avatar asked Dec 06 '22 07:12

Jason FB


1 Answers

Heroku switched the default Node from 14 to 16 in Dec 2021 for the Ruby buildpack .

Heroku updated the heroku/ruby buildpack Node version from Node 14 to Node 16 (see https://devcenter.heroku.com/changelog-items/2306) which is not compatible with the version of Node Sass locked in at the Webpack version you're likely using.

To fix it do these two things:

  1. Specify the 14.x Node version in package.json.
# In package.json
{
  # ...
  "engines": {
    "node": "14.x"
  },
  # ...
}
  1. Add the heroku/nodejs buildpack before the heroku/ruby buildpack. You can do this in the web interface or with the command line. Here is the command for the CLI:
$ heroku buildpacks:add heroku/nodejs -i 1 -a YOUR-APP-NAME

With the NodeJS buildpack running first, it will look at the package.json file and respect that when choosing which version of Node to install. Then the Ruby buildpack will run and since a version of Node already exists it will just use that and everything should work as before.

like image 187
tpett Avatar answered Jan 03 '23 19:01

tpett