metro
metro copied to clipboard
Cannot read property 'transformFile' of undefined
What is the current behavior? I am running into this issue when attempting to build my iOS app in a Release scheme either via Xcode or via the expo CLI. I am able to successfully run the app in the simulator in debug mode.
With the expo-cli the command is npx expo run:ios --configuration Release
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
React Native v0.73.4 Node v18.17 Expo v50 (Bare Workflow)
This is the default generated config
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
module.exports = config;
System Information
OS: macOS 13.5.2
CPU: (10) arm64 Apple M1 Pro
Memory: 151.78 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.0
path: ~/.nvm/versions/node/v18.17.0/bin/node
Yarn:
version: 1.22.15
path: ~/.yarn/bin/yarn
npm:
version: 9.6.7
path: ~/.nvm/versions/node/v18.17.0/bin/npm
Watchman:
version: 2024.01.22.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode:
version: 15.0/15A240d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.4
wanted: 0.73.4
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
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)
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.json
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-provider in terminal
- npx expo install --fix this was a fresh project so there wasn't anything
- npx react-native start --reset-cache
Facing the same issue. I have tried with node 14, 16, 17, 18 and 20 without any luck..