skip to Main Content

I am trying to run react native app on Andriod but I am getting this error presets: ['module:metro-react-native-babel-preset'],, Could someone please help me to how to resolve this issue.

const {getDefaultConfig} = require('metro-config');
module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};
module.exports = (async () => {
  const {
    resolver: {sourceExts, assetExts},
  } = await getDefaultConfig();
  return {
    transformer: {
      babelTransformerPath: require.resolve('react-native-svg-transformer'),
    },
    resolver: {
      assetExts: assetExts.filter(ext => ext !== 'svg'),
      sourceExts: [...sourceExts, 'svg'],
    },
  };
})();

2

Answers


    1. Please check metro-react-native-babel-preset dependency was
      installed in your package.json file.

      If not, install it using this command: npm i metro-react-native-babel- preset --save-dev

    2. Please check babel.config.js file

      There should be this code:

    module.exports = {
    
     presets: ['module:metro-react-native-babel-preset'],
    
     ....
    
    }
    
    Login or Signup to reply.
  1. Just update node to the latest version

    using sudo n latest
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search