React-Native throws " unable to resolve module `http` from `node_mod….\application.js`: http could’t find within module "

after setting up backend environment with express, node and mysql, Initially application didn't receive correct response (received Object => holding content like header config, etc.. ) from backend while using fetch then app crashed with following error

[Wed Nov 18 2020 20:18:02.580]  BUNDLE  ./index.js 

error: Error: Unable to resolve module `http` from `node_modules/express/lib/application.js`: http could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
    at ModuleResolver.resolveDependency (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/node-haste/DependencyGraph.js:287:16)
    at Object.resolve (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at /home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/DeltaBundler/traverseDependencies.js:434:31
    at Array.map (<anonymous>)
    at resolveDependencies (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/DeltaBundler/traverseDependencies.js:431:18)
    at /home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/dhava/CODING MART/#intern-2020/task-9/myntra/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)

I am using cors package in node



Read more here: https://stackoverflow.com/questions/64896103/react-native-throws-unable-to-resolve-module-http-from-node-mod-applica

Content Attribution

This content was originally published by Kavinkumar . N at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: