question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors During Integration with React Native

See original GitHub issue

I am trying to use this package in React Native and use react-native-fs to fufill the FS duties that isomorphic-git requires. However, I noticed that many of the commands (lstat, stat, symlink, etc) that were mentioned by the BYOFS docs page did not exist in that library. As a result, I forked the library and added those commands (on a per-branch basis, then merged all branches into an all-commands branch)

Once I had the 1:1 mapping I knew I’d need, I decided to get started actually using the FS tools at my disposal. So, I created a demo app to test my newfound lstat, etc commands:

A screen with buttons enabling the functionality

And they all seem to write/read/lstat as-expected both from files in the app folder as well as external folders (which is important because Android has some weird permissions for external storage usage)

Next step was to use the isomorphic-git module. I was initially prevented by https://github.com/isomorphic-git/isomorphic-git/issues/597, but the workaround mentioned in a comment https://github.com/isomorphic-git/isomorphic-git/issues/597#issuecomment-443271254 provided a workaround until that issue is closed. So, this is where my use.fs command is, and here’s the file I’m using to map isomorphic-git FS commands to react-native-fs commands.

However, upon running commands I find myself regularly getting ENOENT (No such file or directory) when trying to clone a repo using isomorphic-git.

Running “logs” (adding a console.log on every FS opperation, then trying to clone) provdes me with:

The logs when running git clone ``` Cloning to /data/user/0/com.gitgui/files/test//unist-util-flat-filter.git rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/hooks rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/info rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/objects/info rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/objects/pack rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/heads rnfs-to-iso-git-fs.js:45 mkdir /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/tags rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/HEAD rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/packed-refs rnfs-to-iso-git-fs.js:53 stat /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/HEAD rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/packed-refs rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/HEAD rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/packed-refs rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/heads/master rnfs-to-iso-git-fs.js:53 stat /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/objects/7e/0bef3c6668204450c084bb40edea4bcd742f0f bundle.umd.min.js:1 Unhandled error in "FileSystem.exists()" function Error: stat failed: ENOENT (No such file or directory) at Object.fn [as stat] (NativeModules.js:99) at stat (FS.common.js:304) at Object.stat (rnfs-to-iso-git-fs.js:54) at _callee$ (bundle.umd.min.js:1) at tryCatch (runtime.js:45) at Generator.invoke [as _invoke] (runtime.js:271) at Generator.prototype.<computed> [as next] (runtime.js:97) at c (bundle.umd.min.js:1) at a (bundle.umd.min.js:1) at bundle.umd.min.js:1 rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/shallow rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/shallow rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/config rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/remotes/origin/HEAD rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/remotes/origin/master rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/objects/pack/pack-19444dcb5bcfef470369f4561308e7cc9b63a405.pack rnfs-to-iso-git-fs.js:25 writeFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/objects/pack/pack-19444dcb5bcfef470369f4561308e7cc9b63a405.idx rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/packed-refs rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/master rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/master rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/tags/master rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/refs/heads/master rnfs-to-iso-git-fs.js:21 readFile /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/packed-refs rnfs-to-iso-git-fs.js:53 stat /data/user/0/com.gitgui/files/test/unist-util-flat-filter.git/.git/master bundle.umd.min.js:1 Unhandled error in "FileSystem.exists()" function Error: stat failed: ENOENT (No such file or directory) at Object.fn [as stat] (NativeModules.js:99) at stat (FS.common.js:304) at Object.stat (rnfs-to-iso-git-fs.js:54) at _callee$ (bundle.umd.min.js:1) at tryCatch (runtime.js:45) at Generator.invoke [as _invoke] (runtime.js:271) at Generator.prototype.<computed> [as next] (runtime.js:97) at c (bundle.umd.min.js:1) at a (bundle.umd.min.js:1) at bundle.umd.min.js:1 ExceptionsManager.js:44 Error: stat failed: ENOENT (No such file or directory) ```

At which point my app hits a critical error and the clone no longer continues. Is there any advice for how to advance? I feel entirely stuck on debugging this issue

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
crutchcorncommented, Feb 29, 2020

@wmhilton I’m currently in the Gitter. Looking forward to seeing you there! 👋

1reaction
crutchcorncommented, Feb 26, 2020

Oh golly I’m super excited you were actually able to see this issue!

Ahh, the parent package.json. I can easily update that. I’d set it to try to make prototyping and debugging easier but I can change that for sure.

This weekend would work perfectly for me! I’d absolutely LOVE help with this!

I love love love the outline provided with what errors are throwing what. I think this might be useful as an outline to include in the mention of the fs plugin docs, but I should be able to look into that until this weekend. I super understand the limitations of using errors as a method for checking, I’ve honestly been blown away with how feature filled and stable (from my testing on Node) this project has been!

All in all, I’ll see what I can figure out until this weekend and when it rolls around I’d love the assistance on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Different Approaches to Error Handling in React (Native)
Errors caused by invalid user input or action. Users must be informed of this type of error and how to adjust and continue...
Read more >
React Native Error Handling Best Practices - Rollbar
Error handling in vanilla JavaScript can be achieved using try, catch and finally statements. You can use these statements to handle caught ...
Read more >
React Native: Working with Error Boundaries | by Ross Bulat
This article covers how to integrate and test error boundaries within a React Native app, demonstrating its capabilities and best practices: ... Note...
Read more >
Handling different type of errors in React Native - MCRO
Learn how to efficiently handle different types of errors in React Native and achieve a better mobile app architecture.
Read more >
React Native Debugging & Error Reporting | Bugsnag Platform
Get full stack traces for all React Native errors in a single project, made possible with support for sourcemaps for JavaScript, dSYMS, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found