skip to Main Content

I’m trying to run a react native app using Expo Go, but it shows the following error:

None of these files exist:
  * node_modulesreact-nativeLibrariesComponentsDatePickerDatePickerIOS(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.svg|.svg)
  * node_modulesreact-nativeLibrariesComponentsDatePickerDatePickerIOSindex(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.svg|.svg)
  15 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  16 | import typeof Button from './Libraries/Components/Button';
> 17 | import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS';

The problem is that I don’t even use this component. How can I remove the module?

2

Answers


  1. You can remove a package by going to the package.json folder in your project. Your package should be listed under "dependencies". Remove it and run your project again. Hopefully that fixed it 🤞🏽

    May want to rebuild your node_modules folder by running "npm install".

    Login or Signup to reply.
  2. This is a known issue that is now fixed for the 0.72.0, 0.71.11, 0.70.12, 0.69.12 version patches.

    If you have an older than 0.69 version, and you can’t upgrade, you can use the following Metro configuration to fix the issue:

    // metro.config.js
    const { getDefaultConfig } = require('expo/metro-config');
    
    module.exports = (() => {
      const config = getDefaultConfig(__dirname);
    
      return {
        ...config,
        server: {
          rewriteRequestUrl: (url) => {
            if (!url.endsWith('.bundle')) {
              return url;
            }
            // https://github.com/facebook/react-native/issues/36794
            // JavaScriptCore strips query strings, so try to re-add them with a best guess.
            return url + '?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true';
          },
        },
      };
    })();
    

    or for non-Expo config:

    // metro.config.js
    module.exports = {
      server: {
        rewriteRequestUrl: (url) => {
          if (!url.endsWith('.bundle')) {
            return url;
          }
          // https://github.com/facebook/react-native/issues/36794
          // JavaScriptCore strips query strings, so try to re-add them with a best guess.
          return url + '?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true';
        },
      },
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search