The engine "@aws-amplify/cli" appears to be invalid.
Tags: react, aws
Published: 2023-06-26 11:31:11

Hola hola,

After deploying a build to AWS, I was receiving this error:
```
warning amplify-app@2.24.2: The engine "@aws-amplify/cli" appears to be invalid.
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-android-arm-eabi@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-android-arm-eabi@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-android-arm-eabi@13.2.0: The CPU architecture "x64" is incompatible with this module.
info @next/swc-android-arm64@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-android-arm64@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-android-arm64@13.2.0: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-arm64@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-darwin-arm64@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-darwin-arm64@13.2.0: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-x64@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-darwin-x64@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-freebsd-x64@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-freebsd-x64@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm-gnueabihf@13.2.0: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm-gnueabihf@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm64-gnu@13.2.0: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm64-gnu@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm64-musl@13.2.0: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm64-musl@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-arm64-msvc@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-win32-arm64-msvc@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-arm64-msvc@13.2.0: The CPU architecture "x64" is incompatible with this module.
info @next/swc-win32-ia32-msvc@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-win32-ia32-msvc@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-ia32-msvc@13.2.0: The CPU architecture "x64" is incompatible with this module.
info @next/swc-win32-x64-msvc@13.2.0: The platform "linux" is incompatible with this module.
info "@next/swc-win32-x64-msvc@13.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
error pdfjs-dist@3.6.172: The engine "node" is incompatible with this module. Expected version ">=16". Got "14.20.0"
```

**Solution**
I found this answer in GH. In my case, it was a matter of bumping the `nvm install 14.20.0` and `nvm use 14.20.0` lines to use `16.0.0`.

Here is my `amplify.yml` file:

```
version: 1
backend:
  phases:
    build:
      commands:
frontend:
  phases:
    preBuild:
      commands:
        - nvm install 16.10.0
        - nvm use 16.10.0
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: out
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
```

I hope this helps increase visability.

I've been working with React Native for the last 4 years and will continue documenting common React Native errors that we come across at TroutHouseTech.

-Matt