1

Cannot read property 'native' of undefined ./node_modules/fs-extra/lib/fs/index.js F:/practice/burger-redux/my-app/node_modules/fs-extra/lib/fs/index.js:107

  }
 fs.realpath.native only available in Node v9.2+
> if (typeof fs.realpath.native === 'function') {
  exports.realpath.native = u(fs.realpath.native)
  }

This is a sample of error during fs-extra. Suddenly, an error related to graceful-js error occurred but I was unable to find a solution. Then, I created a new react app. Now I am facing fs-extra issue?

How to solve the issue.

Thank you

Ali Raza
  • 152
  • 9

1 Answers1

2

I've encountered this error myself & thus created an issue: https://github.com/jprichardson/node-fs-extra/issues/743.

Edit:

I don't know if this helps your specific case, but from @gabriel-marcondes, my issue was that

You can't use FS from the client browser.

The solution, from @RyanZim:

You need to dynamically require('fs-extra') inside the methods that use it, that way it won't be required in the browser. Alternately, you could configure webpack (or whatever compiler you're using) to stub fs-extra as an empty object. Either solution should take care of your issue.

And thus, since I'm using typescript, I found good use from https://stackoverflow.com/a/43112861/9285308 and ended up using

async function do_something_that_needs_fs() {
    const fs = await import("fs-extra");
}