Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native bundle error : Module `scheduler` does not exist in the Haste module map

In my react native project if I run the bundling command, It fails with the mentioned error.

Command:

`sudo react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/`

Error:

error Unable to resolve module 'scheduler' from '/home/buddhi/Buddhi/my-dev-environment/html/react-apps/mobile-64/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-prod.js': Module 'scheduler' 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-*'.. Run CLI with --verbose flag for more details.

Versions:

  • "react": "16.8.3"
  • "react-native": "0.59.0"
  • "npm": 6.9.0
  • "node": 10.16.0

When I run the same command with react-native 0.57.2 is runs perfectly. (Note that I need to use react native version 0.59.0 to get the android x64 architecture support for the application)

  1. I have tried the mentioned steps in the error.
  2. I tried by deleting /node_modules and npm install again numerous times.
  3. Tried after npm start --reset-cache.

Still the issue is there.

The change as I can see is that in react-native version 0.59.0 there is the line var scheduler = require("scheduler"), in the file ReactNativeRenderer-prod.js as mentioned in the error. But in react-native version 0.57.2 it is not used.

I'm pretty sure that this is caused by npm, not an issue of the react-native versions. Is it?

Can't figure out why it is not in the mentioned Haste Module Map, and what exactly is the Haste Module Map? I couldn't find enough information to support the issue.

Any help appreciated. Ask for additional information.

like image 398
buddhiv Avatar asked May 25 '26 11:05

buddhiv


1 Answers

If you are using expo, then make sure that your expo and react-native versions are the following:

"expo": "^35.0.0", "react": "16.8.3", "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",

Only this combination worked for me.

like image 176
David Avatar answered May 27 '26 00:05

David