Skip to content
Advertisement

I’m getting error after importing react-native-calendar-picker

I’m new to react-native. I’m getting below errors after importing react-native-calendar-picker:

 ERROR    [Error: InternalError Metro has encountered an error: While trying to resolve module `react-native-calendar-picker` from file `C:UsersNameProjectappAppComponentsDatePickerPopupindex.js`, the package `C:UsersNameProjectappnode_modulesreact-native-calendar-pickerpackage.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:UsersNameProjectappnode_modulesreact-native-calendar-pickerCalendarPicker`. Indeed, none of these files exist:

  * C:UsersNameProjectappnode_modulesreact-native-calendar-pickerCalendarPicker(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg)
  * C:UsersNameProjectappnode_modulesreact-native-calendar-pickerCalendarPickerindex(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg): C:UsersnameProjectappnode_modulesmetrosrcnode-hasteDependencyGraph.js (376:17)

  374 |
  375 |         if (error instanceof InvalidPackageError) {
> 376 |           throw new PackageResolutionError({
      |                 ^
  377 |             packageError: error,
  378 |             originModulePath: from,
  379 |             targetModuleName: to]

Advertisement

Answer

If you have already installed the module, then it seems that metro bundler has not been restarted. Try restarting the bundler.

Advertisement