I’m new to react-native. I’m getting below errors after importing react-native-calendar-picker:
JavaScript
x
13
13
1
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:
2
3
* 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)
4
* 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)
5
6
374 |
7
375 | if (error instanceof InvalidPackageError) {
8
> 376 | throw new PackageResolutionError({
9
| ^
10
377 | packageError: error,
11
378 | originModulePath: from,
12
379 | targetModuleName: to]
13
Advertisement
Answer
If you have already installed the module, then it seems that metro bundler has not been restarted. Try restarting the bundler.