Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile

Tags:

I have updated node today and I'm getting this error:

error: TypeError: Cannot read properties of undefined (reading 'transformFile')
    at Bundler.transformFile (/Users/.../node_modules/metro/src/Bundler.js:48:30)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.transform (/Users/.../node_modules/metro/src/lib/transformHelpers.js:101:12)
    at async processModule (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
    at async traverseDependenciesForSingleFile (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3)
    at async Promise.all (index 0)
    at async initialTraverseDependencies (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3)
    at async DeltaCalculator._getChangedDependencies (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25)
    at async DeltaCalculator.getDelta (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)

Other than that I haven't done anything unusual, so I'm not sure what to share. If I'm missing any info please comment and I'll add it.

While building the terminal also throws this error:

Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at stableHash (/Users/.../node_modules/metro-cache/src/stableHash.js:19:8)
    at Object.getCacheKey (/Users/.../node_modules/metro-transform-worker/src/index.js:593:7)
    at getTransformCacheKey (/Users/.../node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
    at new Transformer (/Users/.../node_modules/metro/src/DeltaBundler/Transformer.js:48:9)
    at /Users/.../node_modules/metro/src/Bundler.js:22:29
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

My node, npx and react-native versions are:

  • node: 17.0.0
  • npx: 8.1.0
  • react-native-cli: 2.0.1
like image 539
Chaudhry Talha Avatar asked Oct 20 '21 13:10

Chaudhry Talha


People also ask

How to fix Cannot read properties of undefined reading transformFile')?

To Solve error: TypeError: Cannot read properties of undefined (reading 'transformFile') Error Simplest and easiest solution is Just downgrade node to v14. 18.1 . And then Just delete node_modules and then try to rebuild your project and your error must be solved.

How do you fix TypeError Cannot read properties of undefined?

To resolve your TypeError: Cannot read properties of undefined (reading '0') , go through these steps: Ensure you are using the correct variable. Perform a simple check on your variable before using it to make sure it is not undefined. Create a default value for the variable to use if it does happen to be undefined.

What does Cannot read property of undefined mean?

What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects.


Video Answer


1 Answers

Ran into the same issue with Node.js 17.0.0. To solve it, I downgraded to version 14.18.1, deleted node_modules and reinstalled.

like image 117
memoalv Avatar answered Sep 17 '22 00:09

memoalv