I get this error whenever I try to use React context,provider or useContext, any of them causes this
On App:
Maximum call stack exceeded
On terminal:
Error: ENOENT: no such file or directory, open '/home/lck/Desktop/workdir/MathApp/mathapp/http:/192.168.0.4:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mathapp&modulesOnly=false&runModule=true' at Object.openSync (node:fs:585:3) at Object.readFileSync (node:fs:453:35) at getCodeFrame (/home/lck/Desktop/workdir/MathApp/mathapp/node_modules/metro/src/Server.js:919:18) at Server._symbolicate (/home/lck/Desktop/workdir/MathApp/mathapp/node_modules/metro/src/Server.js:992:22) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Server._processRequest (/home/lck/Desktop/workdir/MathApp/mathapp/node_modules/metro/src/Server.js:403:7) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/home/lck/Desktop/workdir/MathApp/mathapp/http:/192.168.0.4:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mathapp&modulesOnly=false&runModule=true' }
Advertisement
Answer
Path to context is wrong.
Basically I import ContextFile.js to index.js, and from index.js access to many things. index.js was importing Context from itself, and not from ContextFile.
At fist when I corrected the files, it didn’t work, I don’t know while, I even restarted with npx react-native start
Big Thanks to @Bergi, what he said helped me a lot to solve it. Sadly I don’t know how to tag or message him.
I hope this helps someone else…