Ask questionsUnable to resolve module http


When I try to run my react-native app on ios or android Metro Bundler raises an error saying that I dont have http module installed.

I have tryed this but does not work: watchman watch-del-all rm -rf node_modules run yarn install yarn start --reset-cache rm -rf /tmp/metro-*

I have also reinstalled react-native again, downgraded the version, reinstalled express module and create another new project but the error still exists.

React Native version:

Node: 13.11.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.7 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
react: 16.13.1 => 16.13.1 
react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. Try to upload a new app into any simulator.

Expected Results

I was expecting the app to work normally as it did one month ago.

Snack, code example, screenshot, or link to a repository:

error: bundling failed: 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 (node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15) at ResolutionRequest.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18) at DependencyGraph.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph.js:282:16) at Object.resolve (node_modules/metro/src/lib/transformHelpers.js:267:42) at node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31 at (<anonymous>) at resolveDependencies (node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18) at node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33 at (<anonymous>) at asyncGeneratorStep (node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)

Answer questions vkurchatkin

You are trying to run node.js app with React Native runtime. This is probably a mistake, but either way this won't work


Related questions

Crash on email detection in TextInput on Xiaomi devices running android 10 hot 8
How to fix the error Value for title cannot be cast from ReadableNativeMap to String hot 6
ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7)
Undefined symbol on Flipper using 0.62 on real iOS device
"RnDiffApp" has not been registered - 0.60.5 to 61.0-rc.2 hot 4
native_modules.gradle file is not downloading hot 4
Cannot find module 'C:\Users\USER\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js hot 4
Error: Cannot find module 'warnOnce' hot 4
error Failed to install the app. Make sure you have the Android development environment set up: Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 :ReactNative:Unexpected empty result of running 'npx.cmd --quiet --no-install react-native config' command from 'null' directory. :ReactNative:Running 'npx.cmd --quiet --no-install react-native config' command from 'null' directory failed. hot 4
Hi! I created new react native project and I can't build on android hot 4
React-native I18nManager.forceRTL doesn't applies changes in first app load hot 3
react-native start giving Invalid regular expression invalid error hot 3
Invariant Violation: Module AppRegistry is not a registered callabel module (calling runApplication) hot 3
FlatList TypeError: undefined is not an object (evaluating 'props.getItem') hot 3
Unable to resolve Module 'React' after upgrading to 0.61.4 hot 3
Github User Rank List