metro: Metro has encountered an error: Cannot read properties of undefined (reading 'transformFie'): . . .

Error while running react-native app on ios.

react-native version: 0.67.3

Metro has encountered an error: Cannot read properties of undefined (reading ‘transformFie’): . . .

Tried changing node version to 17, 16.12, 14, etc. but no use.

Please help / guide. Thanks.

Screenshot 2022-03-13 at 7 42 31 PM

detailed error:

Metro has encountered an error: Cannot read properties of undefined (reading 'transformFile'): node_modules/metro/src/Bundler.js (48:30)

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 24 (3 by maintainers)

Commits related to this issue

Most upvoted comments

@NaveenSubburaj no, i have abandoned react native due to bugs like these & lack of support and planning to move to native or flutter, lets see.

This work for me

export NODE_OPTIONS=--openssl-legacy-provider

and i’m not downgrade my node

my node 17.7.1

i’m just install same node from package.json => dependencies => node on folder project react-native

Still facing this issue, reopen this

how did that go? moving to flutter or native because you cant setup your environment, good luck

Yes, this is down to incompatibility of older versions of Metro with Node 17+. Contrary to the original issue report here, I haven’t seen a reproduction for Node <17. The root cause is Node 17 using OpenSSL 3 (https://github.com/nodejs/node/issues/40455), which drops support for MD4 hashing, which we used until #752.

Three options:

  • Update to React Native 0.68 (Metro 0.67) or higher. That includes the Metro fix for Node 17+ compatibility.
  • Use Node 16 or older.
  • Set NODE_OPTIONS=--openssl-legacy-provider

Yes, this is down to incompatibility of older versions of Metro with Node 17+. Contrary to the original issue report here, I haven’t seen a reproduction for Node <17. The root cause is Node 17 using OpenSSL 3 (nodejs/node#40455), which drops support for MD4 hashing, which we used until #752.

Three options:

  • Update to React Native 0.68 (Metro 0.67) or higher. That includes the Metro fix for Node 17+ compatibility.
  • Use Node 16 or older.
  • Set NODE_OPTIONS=--openssl-legacy-provider

Still getting the error with React Native 0.71 on Node 18

EDIT: Weird, my metro is still .66 even on RN .71. Will look into.

I solved this by switching to node v16.

Hi! I solved this issue with downgrading node version. (In my case, v17.4.0 -> v16.13.0)

nodebrew install-binary 16.13.0
nodebrew use 16.13.0
npx react-native run-ios

Same issue here.