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.

Module `react` does not exist in the Haste module map. for library with only JS(react) code

See original GitHub issue

i created a library using react-native-create-library named myLib and i have a RN app from react-native-cli named myApp.

The library “myLib” does not contain any native code and only JS code which imports react(basically made a component that i want to be shared), here is the package.json

{ “name”: “myLib”, “version”: “1.0.0”, “description”: “Set of components to be used throught the app”, “main”: “index.js”, “scripts”: { “test”: “echo "Error: no test specified" && exit 1” }, “keywords”: [ “react-native”, “basic-components” ], “author”: { “name”: “Ullas”, }, “license”: “”, “deprecated”: false, “dependencies”: { “apisauce”: “0.15.2”, “react-native-navbar”: “2.1.0” }, “peerDependencies”: { “react”: “16.3.1”, “react-native”: “0.55.4” } }

when i link this to the RN app “myApp” i get the error :

error: bundling failed: Error: Unable to resolve module react from /Users/ullas/Desktop/myLib/index.js: Module react does not exist in the Haste module map.

even though i have react as part of my node_modules for myApp project. How can i run this and use the dependencies provided by the peer project for my library rather then define dependencies of its own and duplicating the same?

need help 😦

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

59reactions
Samykillscommented, Aug 29, 2018

got it resolved by using “react-native start --reset-cache”, the reference changed from Desktop to node_modules.

41reactions
kumarkundancommented, Oct 25, 2018

Delete your node_module and run npm install

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native issue: Module does not exist in the Haste ...
React Native issue: Module does not exist in the Haste module map ; 2. I encountered the same issue. I wanted to fork...
Read more >
Module doesn't exist in the Haste module map. : r/reactnative
Hi everyone, I'm having some problems with my application (see image below). I've made sure that my package is installed, followed the steps ......
Read more >
React Top-Level API
React is the entry point to the React library. If you load React from a <script> tag, these top-level APIs are available on...
Read more >
Module not found: Can't resolve 'react/jsx-runtime' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your terminal in...
Read more >
react native unable to resolve module - You.com
So the root cause is, the file it lists in the error message is importing the native Node module path , which isn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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