ReferenceError: Property 'Reflect' doesn't exist, js engine: hermes react-native

43.6k Views Asked by At

I am trying to enable hermes in my react native app by following this https://reactnative.dev/docs/hermes in react native website but I get this error message : ReferenceError: Property 'Reflect' doesn't exist, js engine: hermes My RN version : 0.63.4

Thank you in avance

3

There are 3 best solutions below

1
On

If you saw this error immediately without installing any library

Check your latest change in code, it might be a syntax error. For me, I typed some characters mistakenly Check recent git changes

0
On

Edit your android/app/build.gradle file

project.ext.react = [entryFile: "index.js",]
0
On

For me, editing my metro.config.js file from

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
  resolver: {
    assetExts: ['bin', 'txt', 'jpg', 'png', 'ttf'],
    sourceExts: ['js', 'json', 'ts', 'tsx', 'jsx'],
    blacklistRE: blacklist([/platform_node/]),
  },
};

to:

const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const blacklist = require('metro-config/src/defaults/exclusionList');

/**
 * Metro configuration
 * https://facebook.github.io/metro/docs/configuration
 *
 * @type {import('metro-config').MetroConfig}
 */
const config = {
  resolver: {
    assetExts: ['bin', 'txt', 'jpg', 'png', 'ttf'],
    sourceExts: ['js', 'json', 'ts', 'tsx', 'jsx'],
    blacklistRE: blacklist([/platform_node/]),
  },
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);

Resolved the issue.