Reputation: 193
I am unable to deploy deploy an expo 50.0.5 react native web app using metro bundler to AWS amplify.
Details:
Node: v21.1.0
Npm:10.2.0
expo": "~50.0.5
Setup:
Package.json
{
"name": "reactnativewebapp",
"version": "1.0.0",
"main": "expo-router/entry",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~50.0.5",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-web": "~0.19.6",
"react-dom": "18.2.0",
"@expo/metro-runtime": "~3.1.1",
"expo-router": "~3.4.6",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"expo-linking": "~6.2.2",
"expo-constants": "~15.4.5"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
Command I run to create the dist:
npx expo export -p web
version: 1
frontend:
phases:
preBuild:
commands:
- nvm install 18
- nvm use 18
- npm install --silent --global expo-cli
- npm install
build:
commands:
- 'expo export -p web'
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- $(npm root --global)/**/*
ERROR LOG FROM AWS BUILD:
2024-02-08T00:03:42.749Z [INFO]: Now using node v18.19.0 (npm v)
2024-02-08T00:03:42.779Z [INFO]: Installing default global packages from /root/.nvm/default-packages...
2024-02-08T00:03:42.780Z [INFO]: npm install -g --quiet [email protected]
2024-02-08T00:03:42.783Z [WARNING]: node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
2024-02-08T00:03:42.784Z [WARNING]: Failed installing default packages. Please check if your default-packages file or a package in it has problems!
2024-02-08T00:03:42.785Z [INFO]: # Executing command: nvm use 18
2024-02-08T00:03:43.293Z [INFO]: Now using node v18.19.0 (npm v)
2024-02-08T00:03:43.293Z [INFO]: # Executing command: npm install --silent --global expo-cli
2024-02-08T00:03:43.294Z [WARNING]: node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
2024-02-08T00:03:43.296Z [ERROR]: !!! Build failed
2024-02-08T00:03:43.296Z [ERROR]: !!! Error: Command failed with exit code 1
Upvotes: 1
Views: 347
Reputation: 31
The last time I had trouble deploying a Web app on amplify, I built it on vercel instead, it failed on vercel as well, but gave me much better logs that told me why so I could fix it. If you have an import that is not found in your project somewhere, but you never actually use that screen or page, it runs locally because you don't load that screen, but it won't build on amplify and it appears to be a node.js issue for some reason.
Upvotes: 0
Reputation: 21
Maybe you can try to change the build image into the newest one.
For example: Amazon Linux 2023(default)
Refer: https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html
Upvotes: 0