React-native: unable to resolve module ./index react-native

Created on 25 Mar 2019  路  9Comments  路  Source: facebook/react-native

Environment

info
React Native Environment Info:
System:
OS: Windows 7
CPU: (4) x64 Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
Memory: 2.63 GB / 7.91 GB
Binaries:
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842

Bug Duplicate Locked 馃摝Bundler

Most helpful comment

Have you tried running react-native start --reset-cache? This may be related to #24112

All 9 comments

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] alongside an explanation in your Environment: section.

I'm having same problem. Here's output from react-native info. Seems to be coming from metro.

info
  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 2.81 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.10.1 - ~/.nvm/versions/node/v11.10.1/bin/node
      Yarn: 1.13.0 - ~/.nvm/versions/node/v11.10.1/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v11.10.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.1 => 0.59.1

Have you tried running react-native start --reset-cache? This may be related to #24112

Yes seems to be related though in that issue there's focus on run-android. I'm definitely seeing the issue with run-ios.

I'm pretty sure I had no issues in 0.59 a few days ago.

Hi everyone, there is something wrong with version 0.59.1

try this:

  • Stop the MetroBundler/launchPackager
  • Delete node_modules
    rm -rf node_modules
  • Change the version on your package.json
    from
    "react-native": "0.59.1",
    to
    "react-native": "0.58.6",
  • Then clean the watchman
    watchman watch-del-all
  • Run npm install again:
    npm install
  • And try to run your project, in my case:
    react-native run-ios

@BenHurMartins That's definitely a solution but react-native 0.59 introduces support for Hooks. Not an option for those already using Hooks in their apps.

Hey 馃憢 Thanks for the report. Closing as this is a duplicate of https://github.com/facebook/react-native/issues/24112 which has a fix (and a workaround) and is pending release.

Temporary workaround for Windows users
Go to your PROJECT_FOLDER/node_modules/react-native/scripts
Open the file launchPackager.bat with your favorite text editor and add this line

cd '%~dp0..\..\..\'
as follows

@echo off
title Metro Bundler
call .packager.bat
cd "%~dp0..\..\..\"
node "%~dp0..\cli.js" start
pause
exit

Have you tried running react-native start --reset-cache? This may be related to #24112

Worked for me. Thanks

Was this page helpful?
0 / 5 - 0 ratings