glenskie16
glenskie16

Reputation: 51

Switch node version for building on heroku

I am trying to get the node version for when building my rails app on Heroku to 14.18.2. I am unsure on how to change this as I have put the "engines": {"node": "14.18.2"} in my package.json file. By doing this it builds perfectly on my local/repo but, when deploying to heroku and building with heroku it gives me this error

[1/5] Validating package.json...
       error @: The engine "node" is incompatible with this module. Expected version "14.18.2". Got "16.13.1"
       error Found incompatible module.

How do I change this to build with the version I need?

Here is my buildpacks

1. https://github.com/gaffneyc/heroku-buildpack-jemalloc.git
2. heroku/metrics
3. heroku/ruby

Thank you for your help!

Upvotes: 0

Views: 1061

Answers (1)

Lobana
Lobana

Reputation: 11

why you add "heroku/metrics" buildpack, it should be "heroku/nodejs", and then push changes to main branch. and be sure to make heroku/nodejs in the first order. so when you run

heroku buildpacks -a your_app_name

  1. heroku/nodejs
  2. heroku/ruby

check this https://devcenter.heroku.com/articles/ruby-support#installed-binaries

for review apps on heroku you should add buildpacks in app.json file

"buildpacks": [
        {
            "url": "heroku/nodejs"
        },
        {
            "url": "heroku/ruby"
        }
    ]

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

Upvotes: 1

Related Questions