node-fs-extra icon indicating copy to clipboard operation
node-fs-extra copied to clipboard

TypeError is not a function for file write functions

Open sebastianwessel opened this issue 1 year ago • 1 comments

  • Operating System: macOS 14.2.1 (23C71)
  • Node.js version: 20.11
  • fs-extra version: 11.2.0
  • @types/fs-extra version: 11.0.4
  • typescript version: 5.3.2

writeJson/writeJSON and outputJson/outputJSON and corresponding sync functions are throwing.

Example:

import * as fsExtra from 'fs-extra'

await fsExtra.writeJson(fileName, {some:'content'})

Error during execution:

TypeError: fsExtra.[writeJson] is not a function

sebastianwessel avatar Feb 03 '24 10:02 sebastianwessel

Try import fsExtra from 'fs-extra'

RyanZim avatar Feb 05 '24 21:02 RyanZim