buildpacks / registry-api

API for searching and reading the Buildpack Registry
Apache License 2.0
3 stars 8 forks source link

Fix node-sass build failure by pinning to Node.js 14 #77

Closed joshwlewis closed 2 years ago

joshwlewis commented 2 years ago

Recent Heroku CI builds are failing with node-sass compilation errors as shown here: https://dashboard.heroku.com/apps/cnb-registry-api-staging/activity/builds/061da7cf-2133-4eaf-8e55-05001275b590

Heroku's default Node.js version has recently changed to the 16.x line. This project uses node-sass@4.14.1, which does not compile against Node.js 16 or better. node-sass@6.0.1 does compile on on Node.js 16, but node-sass is a nested dependency of @rails/webpacker, which is retired and has no released version with a newer node-sass. I think it's more straightforward to pin to Node.js 14.x for now.

This change requires the buildpack order to be specified. The heroku/ruby buildpack will try to install the latest Node.js if it does not detect one. We want the heroku/nodejs buildpack to run first, so that it installs the correct version (14.x). The staging app already has the order set correctly. The app.json changes ensure that review apps use the correct order, too.

joshwlewis commented 2 years ago

Latest failure:

error search@0.0.1: The engine "node" is incompatible with this module. Expected version "14.x". Got "16.13.1"

This was caused by buildpack ordering. Fixed in fb6babc.