【问题标题】:I'm getting error after importing react-native-calendar-picker导入 react-native-calendar-picker 后出现错误
【发布时间】:2021-09-09 10:20:38
【问题描述】:

我是 react-native 的新手。导入 react-native-calendar-picker 后出现以下错误:

 ERROR    [Error: InternalError Metro has encountered an error: While trying to resolve module `react-native-calendar-picker` from file `C:\Users\Name\Project\app\App\Components\DatePickerPopup\index.js`, the package `C:\Users\Name\Project\app\node_modules\react-native-calendar-picker\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\Name\Project\app\node_modules\react-native-calendar-picker\CalendarPicker`. Indeed, none of these files exist:

  * C:\Users\Name\Project\app\node_modules\react-native-calendar-picker\CalendarPicker(.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:\Users\Name\Project\app\node_modules\react-native-calendar-picker\CalendarPicker\index(.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:\Users\name\Project\app\node_modules\metro\src\node-haste\DependencyGraph.js (376:17)

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

【问题讨论】:

    标签: javascript react-native react-native-calendars


    【解决方案1】:

    如果你已经安装了模块,那么metro bundler似乎没有重新启动。尝试重新启动捆绑程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-25
      • 2021-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多