Deploying Expo React Native Web to Amplify

Viewed 174

I'm trying to deploy a static react-native application to AWS Amplify using an expo build. Every time I create a build it errors out with this error:

Node.js v10.16.0 is no longer supported.
                                    expo-cli supports following Node.js versions:
                                    * >=12.13.0 <13.0.0 (Maintenance LTS)
                                    * >=14.0.0 <15.0.0 (Active LTS)
                                    * >=15.0.0 <17.0.0 (Current Release)

It looks like earlier before this error this command is ran:

Executing command: nvm use 10

My local version of Node is 16.8 where I developed the app and my expo is the latest version. Why is that command running "nvm use 10" and how do I change it to the correct node version.

This is my YAML file:

version: 1.0
frontend:
  phases:
    preBuild:
      commands:
        - npm install --quiet --global expo-cli
        - >
          if [ -f yarn.lock ]; then
            yarn
          elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
            npm ci
          else
            npm install
          fi
    build:
      commands:
        - expo build:web
  artifacts:
    baseDirectory: web-build
    files:
      - "**/*"
  cache:
    paths:
      - node_modules/**/*
      - $(npm root --global)/**/*
1 Answers

Try this, it's works for me:

version: 1.0
frontend:
  phases:
    preBuild:
      commands:
        - npm install --quiet --global expo-cli
        - >
          if [ -f yarn.lock ]; then
            yarn
          elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
            npm ci
          else
            npm install
          fi
    build:
      commands:
        - expo build:web
  artifacts:
    baseDirectory: web-build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      - $(npm root --global)/**/*
Related