Module `react` does not exist in the Haste module map. for library with only JS(react) code
See original GitHub issuei 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:
- Created 5 years ago
- Reactions:13
- Comments:20 (3 by maintainers)
Top GitHub Comments
got it resolved by using “react-native start --reset-cache”, the reference changed from Desktop to node_modules.
Delete your node_module and run npm install