Ramana Sakhavarapu
Ramana Sakhavarapu

Reputation: 124

Not able to use react-native-calendars

error: bundling failed: Error: Unable to resolve module hoist-non-react-statics from E:\DEVELOPMENTWORKSPACE\test\node_modules\react-native-calendars\src\expandableCalendar\asCalendarConsumer.js: Module hoist-non-react-statics does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968

To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

Upvotes: 6

Views: 2971

Answers (1)

Emanuele Sacco
Emanuele Sacco

Reputation: 431

The problem is that src/expandableCalendar/asCalendarConsumer.js is trying to import 'hoist-non-react-statics' which is not declared as a dependency in package.json So the solution is to add it in package.json as this:

"dependencies": {
"lodash": "^4.0.0",
"prop-types": "^15.5.10",
"xdate": "^0.8.0",
"hoist-non-react-statics": "*"},

than run npm install run react-native run-ios and you're up to go!

Upvotes: 3

Related Questions