Ruby on rails 6: how to upgrade node version on webpacker 5.2.1?

I try to deploy the rails 6 App on platformsh, I have this error when deploying my project in Rails 6 with Webpacker 5.2.1.

I have done days of research on google, without success. I have NVM installed locally, node and npm, I will say that everything is fine locally, the webpacker is compiled correctly, but not on the remote machine. and this error makes the deployment fail.

    W: Webpacker requires Node.js ">=10.17.0" and you are using v6.17.1
    W: Please upgrade Node.js https://nodejs.org/en/download/
    W: Exiting!
  
  E: Error building project: Step failed with status code 1.

E: Error: Unable to build application, aborting.

when I want to compile the assets with this line on Build hook.

RAILS_ENV=production bundle exec rails webpacker:install

can you help me I’ll share my config

.platform.app.yaml

    # The name of this app. Must be unique within a project.
name: app
type: 'ruby:2.7'
mounts:
    log:
      source: local
      source_path: log
    tmp:
      source: local
      source_path: tmp
relationships:
    postgresdatabase: 'dbpostgres:postgresql'
# The size of the persistent disk of the application (in MB).
disk: 1024
hooks:
    build: |
      bundle install --without development test
      RAILS_ENV=production bundle exec rails webpacker:install               
    deploy: |
      RAILS_ENV=production bundle exec rake db:migrate 
web:
  upstream: 
    socket_family: "unix"
  commands: 
    start: "unicorn -l $SOCKET -E production config.ru"
  locations: 
    '/': 
      root: "public"
      passthru: true
      expires: 1h
      allow: true

services.yaml

dbpostgres:
# The type of your service (postgresql), which uses the format
# 'type:version'. Be sure to consult the PostgreSQL documentation
# (https://docs.platform.sh/configuration/services/postgresql.html#supported-versions)
# when choosing a version. If you specify a version number which is not available,
# the CLI will return an error.
type: postgresql:13
 # The disk attribute is the size of the persistent disk (in MB) allocated to the service.
disk: 9216
configuration:
  extensions:
    - plpgsql
    - pgcrypto
    - uuid-ossp

routes.yaml

    # Each route describes how an incoming URL is going to be processed by Platform.sh.
"https://www.{default}/":
    type: upstream
    upstream: "app:http"

"https://{default}/":
    type: redirect
    to: "https://www.{default}/"

Hi @kam-vakaramoko. It looks like you’ll need to upgrade the version of Node.js in your Ruby container. Here is a guide for how to use NVM during the build hook to install whichever version you may need https://docs.platform.sh/languages/nodejs/nvm.html.