I upgraded node on my local machine as well as migrated from create-react-app
to nextjs
.
When I pushed my code to AWS Amplify, I got this error:
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=12.22.0". Got "12.21.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I've looked on stackoveflow and other blogs and I've tried everything, but I still get this error.
My trials:
"engines": {
"node": ">=12.22.0"
}
sudo npm cache clean -f
sudo npm install -g n
node -v
v16.13.0
Why is this error still occurring?
You are only using node v16 locally, amplify for some reason uses a lower one. You could either downgrade the package (not recommended imho) or tell amplify to use a higher node version (recommended imho).
frontend:
phases:
preBuild:
commands:
- nvm install 16
Find the official documentation on how to change build settings here:
https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html