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.

memfs breaks with fs-extra^10.0.0

See original GitHub issue

memfs does not export fs.realpath.native. It is available since Node.js 9.2.0. https://nodejs.org/api/fs.html#fsrealpathnativepath-options-callback

fs-extra uses univeralify to create a promise version of fs.realpath.native. Because memfs does not provide it, universalify throws a error:

TypeError: Cannot read properties of undefined (reading 'name')

      at Object.<anonymous>.exports.fromCallback (../../node_modules/fs-extra/node_modules/universalify/index.js:15:26)
      at Object.<anonymous> (../../node_modules/fs-extra/lib/fs/index.js:57:27)
      at Object.<anonymous> (../../node_modules/fs-extra/lib/index.js:5:6)

The error occurs even if realpath.native is not used.

The line of code: https://github.com/jprichardson/node-fs-extra/blob/a84ef6dd8969f57d16e23267e1790def791e9a82/lib/fs/index.js#L57

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:13

github_iconTop GitHub Comments

1reaction
Phillip9587commented, Apr 10, 2022

@peteriman I’m gonna look into it on monday. Hope it was no wrong report from my side.

1reaction
lamweilicommented, Apr 10, 2022

@G-Rath, assuming it’s not a NodeJS <9.2.0 issue, I am unable to replicate it using NodeJS 14 with memfs@^3.4.1.

const assert = require('assert');
const memfs = require('memfs'); // memfs@^3.4.1

assert(typeof fs.realpath.native === 'function'); // is fine, not undefined

const fse = require('fs-extra'); // fs-extra@^10.0.1 - is fine, no errors as claimed

Might need more details from @Phillip9587. It is also possible to be an inherent nx behaviour that altered fs but reported wrongly as https://github.com/nrwl/nx/pull/8531.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js: fs-extra
fs -extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.
Read more >
memfs | Yarn - Package Manager
memfs. In-memory file-system with Node's fs API. Node's fs API implemented, see old API Status, missing list, missing opendir; Stores files in memory, ......
Read more >
node-fs-extra
Starting with fs-extra 10.0.0 on node 14.14+, failures to rm a file that exists, but is in an unwritable directory, fail silently. fs-extra...
Read more >
Dependencies | @backstage/cli | npm
arrow_right @babel/core. 7.20.5 Notes Version 7.20.5 Published November 28... arrow_right @babel/plugin‑transform‑modules‑commonjs. 7.19.6 Notes Version 7.19.6 Published October 20, 20...
Read more >
Npm package installation error on other partition
... 156 silly audit 'fs-extra': [ '9.1.0', '10.1.0' ], 156 silly audit tapable: ... 156 silly audit memfs: [ '3.4.1' ], 156 silly...
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