I am attempting to build a release version of my React Expo Bare Workflow iOS application and when I run the command npx expo run:ios --configuration Release or build through Xcode, I get the following error:
Failed to construct transformer: /Users/{USER}/Documents/Projects/sentiance-expo/node_modules/@expo/metro-config/build/transform-worker/asset-transformer.js:21
options ??= options || {
^^^
SyntaxError: Unexpected token '??='
...
My package.json
{
"name": "sentiance-expo",
"version": "1.0.0",
"main": "expo-router/entry",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@apollo/client": "^3.9.4",
"@babel/runtime": "^7.23.9",
"@mapbox/polyline": "^1.2.1",
"@react-navigation/drawer": "^6.6.7",
"@sentiance-react-native/core": "^6.6.0",
"@sentiance-react-native/event-timeline": "^6.6.0",
"@types/react": "~18.2.45",
"axios": "^1.6.7",
"expo": "^50.0.0",
"expo-clipboard": "~5.0.1",
"expo-constants": "~15.4.5",
"expo-dev-client": "~3.3.8",
"expo-device": "~5.9.3",
"expo-linking": "~6.2.2",
"expo-location": "~16.5.3",
"expo-router": "~3.4.7",
"expo-sensors": "~12.9.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"graphql": "^15.8.0",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-circular-progress": "^1.3.9",
"react-native-device-info": "^10.12.0",
"react-native-gesture-handler": "~2.14.0",
"react-native-maps": "1.10.0",
"react-native-permissions": "^3.3.1",
"react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-svg": "^14.1.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.23.9",
"@types/mapbox__polyline": "^1.0.5",
"@types/progressbar.js": "^1.1.7",
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
"private": true
}
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"],
};
};
Things I've tried:
- Deleting package-lock.json, node modules, pods, podfile.lock and reinstalling all of them
- Deleting and rebuilding iOS build folder
- Attempted to downgrade to lowest Node version (v18)
export NODE_OPTIONS=--openssl-legacy-providerin terminalnpx expo install --fixthis was a fresh project so there wasn't anythingnpx expo-doctor
I am able to run this app both in android and iOS in their emulators so I can confirm that the app does indeed work.
Further stacktrace:
error: Cannot read property 'transformFile' of undefined
TypeError: Cannot read property 'transformFile' of undefined
TypeError: Cannot read property 'transformFile' of undefined
at Bundler.transformFile (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/Bundler.js:43:30)
at async Object.transform (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/lib/transformHelpers.js:130:12)
at async transform (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/Graph.js:164:26)
at async visit (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/buildSubgraph.js:82:29)
at async Promise.all (index 0)
at async buildSubgraph (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/buildSubgraph.js:103:3)
at async Graph._buildDelta (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/Graph.js:157:22)
at async Graph.initialTraverseDependencies (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/Graph.js:140:19)
at async DeltaCalculator._getChangedDependencies (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:151:25)
at async DeltaCalculator.getDelta (/Users/[USER]/Documents/Projects/sentiance-expo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:68:16)
What node version are you running?
node -vThe
??=syntax is only supported in Node 15 and higher.