react-native, bundling failed

Just restart the bundler - no need to delete the Node Modules folder

I came across this issue when adding and using react-native-elements when using VS Code and Android Studio emulator on Linux Mint

In VS Code I had a terminal running Expo with Metro Bundler via 'npm start' command. After installing the react-native-elements in the folder (using 'npm install --save react-native-elements') and adding the import into the .js file I got the "However, this package itself specifies a main module field that could not be resolved" error.

In my case, this just involved a ^C in the terminal session to stop the Metro bundler and then running 'npm start' again. There was no need to delete the node modules folder at all.


It Usually happens if you try to install a module while your packager is open.

Try to delete node_modules folder and close the packager. Then reinstall everything by npm install in your project directory.


First close your JavaScript bundler (Metro bundler in my case) and restart the application. This will create fresh dependency graph. This should solve the issue.


If you're still getting the error even after deleting the ./node_modules folder and running npm install again, try doing the install with the --update-binary flag, i.e npm install --update-binary. This should clear out and rebuild any previously built packages on your machine.