question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Haste module overrides for react-native-windows resolution failures

See original GitHub issue

Environment

Run react-native info in your terminal and paste its contents here.

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.3
      CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 90.15 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.9.4 - /usr/local/bin/node
      Yarn: 1.7.0 - /usr/local/bin/yarn
      npm: 6.1.0 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 25.0.3, 26.0.2, 27.0.3
        API Levels: 23, 25, 27
    IDEs:
      Android Studio: 3.0 AI-171.4443003
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.3.2 => 16.3.2 
      react-native: 0.56.0-rc.1 => 0.56.0-rc.1 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Description

Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know.

react-native-windows overrides haste modules in react-native, currently using the @providesModule attribute. For example, the ScrollView module in react-native has behavior that limits it to iOS and Android, we we override the module in react-native-windows here.

Prior to react-native 0.56.0 RC (which moved to metro 0.38), this behavior worked as expected. Now, the haste module overrides for windows no longer seem to get resolved. Specifically, I get the following error:

Unable to resolve module `AccessibilityInfo` from `/Users/rozele/code/sandbox/v56/node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module `AccessibilityInfo` 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-*`.

Please note - the AccessibiltyInfo module just happens to be the first module in the dependency graph that we provide a *.windows.js override for, so it has nothing to do with that module specifically.

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

A very simple test that repos (on both Windows and Mac):

  1. Generate a new react-native project with 0.56.0-rc.4:
react-native init test --version 0.56.0-rc.4
  1. Generate a react-native-windows project:
yarn add rnpm-plugin-windows
react-native windows --windowsVersion 0.55.0-rc.0
  1. Try to generate a windows platform bundle
react-native bundle --platform windows --entry-file index.js --bundle-output test.bundle

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:23
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
eazzyLEEcommented, Jul 16, 2018

@rubennorte Please, this is still an issue and it’s becoming really frustrating. I had to downgrade to 0.55.4, it worked but there are vulnerabilities that npm suggests npm install react-native @0.56.0 will fix. Going back to that version will return the same “AccessibilityInfo” bug.

What can be done? rnative

17reactions
PerspectivesLabcommented, Jul 16, 2018

this => Unable to resolve module AccessibilityInfo is still an issue for 0.56.0, compiling for android on windows platform … what is going wrong ? this is a major issue… i cant believe this is happening for 0.56 after 6 release candidates…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module Resolution | Metro - Meta Open Source
Module resolution is the process of translating module names to module paths at build time. For example, if your project contains the code:...
Read more >
module redux does not exist in the haste module map
However when I run a build to a simulator or device I get an error about the redux module not being in the...
Read more >
react-native | Yarn - Package Manager
React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access...
Read more >
How to share code between iOS, Android & Web using React ...
Hi, I updated the tutorial with the latest changes from react-native@0.59 , search for projectRoot to see the updated step involving the file ......
Read more >
Behind the Scenes: Improving the Repository Infrastructure
We decided to remove Haste and use the Node resolution with relative imports ... We still ship CommonJS modules for Node.js and bundlers, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found