react-native: Unable to resolve module `schedule/tracking`

Environment

React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Memory: 536.34 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 8.11.4 - ~/.nodenv/versions/8.11.4/bin/node npm: 5.6.0 - ~/.nodenv/versions/8.11.4/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3 IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild npmPackages: react: 16.4.1 => 16.4.1 react-native: ^0.57.0 => 0.57.0 npmGlobalPackages: react-native-cli: 2.0.1

Description

After updating to RN 0.57.0, I get

error: bundling failed: Error: Unable to resolve module `schedule/tracking`
Looking for JS files in
   /Users/khoa/XcodeProject2/myapp

warning: the transform cache was reset.
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `schedule/tracking` from `/Users/khoa/XcodeProject2/myapp/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js`: Module `schedule/tracking` 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-*`.
    at ModuleResolver.resolveDependency (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209:1301)
    at ResolutionRequest.resolveDependency (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:83:16)
    at DependencyGraph.resolveDependency (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/node-haste/DependencyGraph.js:238:485)
    at Object.resolve (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/lib/transformHelpers.js:180:25)
    at dependencies.map.result (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:311:29)
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:307:16)
    at /Users/khoa/XcodeProject2/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:164:33
    at Generator.next (<anonymous>)
    at step (/Users/khoa/XcodeProject2/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:266:307)

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve

Right now I need to switch back to 0.56.0 for it to work again. Also, on 0.57.0 I get https://github.com/facebook/react-native/issues/21094

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 42
  • Comments: 35 (3 by maintainers)

Commits related to this issue

Most upvoted comments

After several hours spent on a huge 0.55->0.57 RN migration, I think it’s a RN incompatibility with React 16.5.2. As you can see in React’s changelog and in React Native’s source schedule/tracking has been changed to schedule/tracing and React Native uses the old name. I don’t know why naming change landed in a minor version update. Switching back to React 16.5.1 can do the job too.

I solved this by installing the previous version of the schedule package:

npm i schedule@0.4.0 --save-dev

Hey 👋 So, now RN 0.57.3 is out which means that this is fixed, BUT you NEED to upgrade react and react-test-renderer to version "16.6.0-alpha.8af6728".

It’s safe, I’ve tested 0.57.3 in multiple apps without issues these past few hours. (if you prefer to not, you can wait for future 0.57.x releases, 16.6.0 will be most likely released in a couple weeks at ReactConf).

I know it’s not ideal, but, again, I tested and hit no walls.

Quick update on this: a commit from the internal FB codebase is going to land soon (next couple days) and will sync the React deps (similar to this commit).

So hold on, a fix will be there soon.

👋 everyone, thanks for reporting - we’ll try to have a look at it asap!

In particular thanks @krzysztof-miemiec for the details

I have the same problem, and tried npm i schedule@0.4.0 --save-dev then it worked.

As @krzysztof-miemiec mentioned, releases are tested. And there are reasons if we have rc phases and then we keep releasing minor versions.

That said, update on this issue, a commit finally landed on master this weekend - and it will enabled usage of React 16.5.2 -> https://github.com/facebook/react-native/commit/7142e9b1c5f95e82ceb04798b166318385004147

I am on React 16.3.2 & RN0.57, still facing the same error. Trying to update to React 16.5.1 didn’t work either… 😦

error: bundling failed: Error: Unable to resolve module `schedule/tracking` from `node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js`: Module `schedule/tracking` does not exist in the Haste module map

I tried and it worked:

yarn add @babel/runtime@7.0.0

Looks like it works with yarn add schedule@0.4.0 --dev (or npm i schedule@0.4.0 --save-dev) but it doesn’t with schedule@0.5.0

I also had to yarn add @babel/runtime@7.0.0 --dev

@ithustle Read the comments! kelset’s answer

So, now RN 0.57.3 is out which means that this is fixed, BUT you NEED to upgrade react and react-test-renderer to version "16.6.0-alpha.8af6728".

@kelset whats the reason for syncing with 16.6.0-alpha instead of 16.5.2?

I was able to get things working by installing @babel/runtime and schedule@0.4.0, thanks to everyone’s comments on this issue.

Upgrading to RN 0.57.1 I receive the following error:

Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map

In my dependencies I’ve then added @babel/runtime

That error disappears but then I have another one:

node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js: Module schedule/tracking` does not exist in the Haste module map

Using an older version of react package (16.5.1), as suggested by @krzysztof-miemiec, the error still appears.

My package.json is the following:

"dependencies": {
    "@babel/runtime": "^7.0.0",
    "ent": "^2.2.0",
    "jssha": "^2.3.1",
    "lodash": "^4.17.11",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.21",
    "react": "^16.5.1",
    "react-native": "^0.57.1",
    "react-native-elements": "^0.19.1",
    "react-native-fast-image": "^5.0.10",
    "react-native-htmlview": "^0.13.0",
    "react-native-hyperlink": "0.0.14",
    "react-native-linear-gradient": "^2.4.2",
    "react-native-remote-svg": "^1.3.0",
    "react-native-scrollable-tab-view": "^0.8.0",
    "react-native-svg": "^7.0.3",
    "react-native-vector-icons": "^5.0.0",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-saga": "^0.16.0",
    "reselect": "^3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "concurrently": "^4.0.1",
    "jest": "^23.6.0",
    "metro-react-native-babel-preset": "^0.46.0",
    "msvgc": "^0.1.1",
    "prettier": "1.14.3",
    "react-dom": "^16.5.2"
 }

@hkung77 After update/downgrade of React/React Native I usually run into issues because of yarn.lock stuck with different version number for some specific dependencies. You can try removing that file, cleaning node_modules and rebuilding everything. I made a handy purge command in my project’s package.json for clean+install+prepare:

{
  "scripts": {
    "clean": "rimraf '{build,.jest,ios/build,android/build}'",
    "clean:all": "yarn clean && rimraf {node_modules,./gems,ios/Pods,android/.gradle}",
    "fastlane": "export LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && bundle exec fastlane",
    "nodeify": "rn-nodeify --install net,process,util,stream --hack",
    "postinstall": "bundle install && butler patch && yarn remotedev && yarn nodeify",
    "prepare:all": "yarn prepare:ios && yarn prepare:android",
    "prepare:ios": "yarn fastlane ios prepare",
    "prepare:android": "yarn fastlane android prepare",
    "purge": "yarn clean:all && yarn && yarn prepare:all"
  }
}

The prepare part is for automatic asset (app icons) generation and pod install done by Fastlane plugins.

My bad, thanks @pistou and @kelset

Guys, I update RN to 0.57.3 with schedule 0.4.0 (installed before) and React 16.5.2 and doesn’t work.

Any help?

Guys, I’m on react-native 0.57.3 and installing scheduler resolved my problem

it would be great if new releases of react-native were tested - the number of issues when upgrading is unbelievable

@krzysztof-miemiec thanks! Downgrading to react 16.5.1 worked for me! Haven’t tried the other options.

it seems schedule 0.5.0 package error, thanks @stafak

Yes it’s very advisable to stick with the react version that each react-native version recommends in the package.json.

Hi all, this is my package.json and it works for me 😉

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "^0.57.3"
  },
  "devDependencies": {
    "@babel/runtime": "7.0.0",
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "react-test-renderer": "16.6.0-alpha.8af6728",
    "schedule": "^0.4.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

@krzysztof-miemiec I deleted my my node_modules and removed the package-lock, before I do a fresh npm install. But still the same issue