Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve module schedule/tracking #21150

Closed
onmyway133 opened this issue Sep 17, 2018 · 35 comments
Closed

Unable to resolve module schedule/tracking #21150

onmyway133 opened this issue Sep 17, 2018 · 35 comments
Labels
JavaScript Resolution: Locked This issue was locked by the bot.

Comments

@onmyway133
Copy link

onmyway133 commented Sep 17, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) 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 #21094

@cristianonescu
Copy link

I have the same issue. Indeed this comes with 0.57.0, switching back to 0.56.0 doesn't have the same behaviour.

@stafak
Copy link

stafak commented Sep 18, 2018

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

npm i [email protected] --save-dev

@codetay
Copy link

codetay commented Sep 19, 2018

it seems schedule 0.5.0 package error, thanks @stafak

@krzysztof-miemiec
Copy link

krzysztof-miemiec commented Sep 20, 2018

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.

@hkung77
Copy link

hkung77 commented Sep 21, 2018

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

@krzysztof-miemiec
Copy link

krzysztof-miemiec commented Sep 21, 2018

@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.

@hkung77
Copy link

hkung77 commented Sep 21, 2018

@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

@kelset
Copy link
Contributor

kelset commented Sep 24, 2018

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

In particular thanks @krzysztof-miemiec for the details

@flexaddicted
Copy link

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"
 }

@kelset
Copy link
Contributor

kelset commented Sep 25, 2018

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.

@flexaddicted
Copy link

@kelset Thank you for the update!

@liudonghua123
Copy link

I have the same problem, and tried npm i [email protected] --save-dev then it worked.

@jannl
Copy link

jannl commented Sep 26, 2018

I have the same error, I try to use yarn add [email protected],but it still doesn't work.

Failed to load bundle (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false)with error:(Unable to resolve module 'schedule/tracking' from '/Users/Aaron/waveform/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js':Module 'schedule/tracking' does not exist in the haste module map.

@ntamvl
Copy link

ntamvl commented Sep 27, 2018

I tried and it worked:

yarn add @babel/[email protected]

@pistou
Copy link

pistou commented Sep 27, 2018

Looks like it works with yarn add [email protected] --dev (or npm i [email protected] --save-dev) but it doesn't with [email protected]

I also had to yarn add @babel/[email protected] --dev

@jannl
Copy link

jannl commented Sep 28, 2018

@pistou try this yarn add @babel/[email protected]yarn and @babel/[email protected]yarn add @babel/[email protected]

@ujwal-setlur
Copy link

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

@cjam
Copy link

cjam commented Oct 3, 2018

I was able to get things working by installing @babel/runtime and [email protected], thanks to everyone's comments on this issue.

mikedemarais added a commit to balance-io/balance-wallet that referenced this issue Oct 4, 2018
@narciero

This comment has been minimized.

@krzysztof-miemiec
Copy link

@narciero they are tested, this is why [email protected] had React dependency strictly locked on 16.5.0. Although I agree with you - upgrades are quite painful, i.e. pagination was broken on Android in 0.57.0. We keep forgetting that RN is still big WiP (no 1.x.x release) and not quite production-ready yet.

@narciero
Copy link

narciero commented Oct 7, 2018

@krzysztof-miemiec understandable, though even a fresh react-native init MyProject does not work out of the box on 0.57.0 - I understand upgrades are still a WIP but I'd hope a fresh project would work (it does not)

@HashDot
Copy link

HashDot commented Oct 8, 2018

Rollback to React 16.5.0 and it works!

@kelset
Copy link
Contributor

kelset commented Oct 8, 2018

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 -> 7142e9b

@kesha-antonov
Copy link
Contributor

@kelset Thanks!

@kelset
Copy link
Contributor

kelset commented Oct 12, 2018

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.

@kelset kelset closed this as completed Oct 12, 2018
@danilobuerger
Copy link
Contributor

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

@rahulbhankar786
Copy link

@danilobuerger https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md

@danilobuerger
Copy link
Contributor

@rahulbhankar786 That link doesn't provide a reason either.

@mschipperheyn
Copy link

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

@betranthanh
Copy link

betranthanh commented Oct 16, 2018

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"
  }
}

@MWalid
Copy link

MWalid commented Oct 17, 2018

Changin react version to 16.6.0-alpha.8af6728 resolved my issue

@ujwal-setlur
Copy link

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

@ithustle
Copy link

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?

@pistou
Copy link

pistou commented Oct 18, 2018

@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".

@ithustle
Copy link

My bad, thanks @pistou and @kelset

@facebook facebook locked as resolved and limited conversation to collaborators Oct 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
JavaScript Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.