Hery
Hery

Reputation: 392

React native debugger: "Error: ENOENT: no such file or directory"

Problem: When I run the remote debugger, metro server says it can't find this file.

Error: ENOENT: no such file or directory, open '/home/hery/Workspace/NyTiona/http:/localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.nytiona&modulesOnly=false&runModule=true'
    at Object.openSync (fs.js:498:3)
    at Object.readFileSync (fs.js:394:35)
    at getCodeFrame (/home/hery/Workspace/NyTiona/node_modules/metro/src/Server.js:919:18)
    at Server._symbolicate (/home/hery/Workspace/NyTiona/node_modules/metro/src/Server.js:992:22)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Server._processRequest (/home/hery/Workspace/NyTiona/node_modules/metro/src/Server.js:403:7) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/hery/Workspace/NyTiona/http:/localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.nytiona&modulesOnly=false&runModule=true'
}

Note: This error always appears whether I am using USB or Wi-Fi.

info: My react native info

    System:
    OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
    Memory: 1.51 GB / 7.49 GB
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.17.2 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.13 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 30
      Build Tools: 30.0.2, 30.0.3, 31.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.65.1 => 0.65.1 
  npmGlobalPackages:
    *react-native*: Not Found

Thanks 😃

Upvotes: 16

Views: 16880

Answers (2)

Renato Aloi
Renato Aloi

Reputation: 320

Based on Shoaib Khan anwser, I managed to solve the problem by opening two terminals, one with the command below:

npx react-native start "--reset-cache"

And in the other terminal, just bring android up:

npx react-native run-android

Dont forget deleting node_modules directory to reinstall them by running npm install.

Upvotes: -4

Shoaib Khan
Shoaib Khan

Reputation: 1210

I ran into the same problem and just did,

npm start -- --reset-cache

solved my problem.

Upvotes: 7

Related Questions