Search code examples
react-nativenode-modulesmetro-bundler

No aplication.js in http node module


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

I have tryed npm react-native install http and it is installed correctly but when I upload the app raises me this error:

error: bundling failed: Error: While trying to resolve module http from file /node_modules/express/lib/application.js, the package node_modules/http/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (node_modules/http/index.js.


Solution

  • I just figured out why I had this error. I was trying to use the variable styles the wrong way