Skip to content

When I tried to deconstruct "stat", I got "Cannot read properties of undefined (reading '_checkModeProperty')" #3713

@brenner8023

Description

@brenner8023

Details

When I tried to deconstruct "stat", I got "Cannot read properties of undefined (reading '_checkModeProperty')".

image

image

image

Node.js version

v16.13.2

Example code

const fs = require('fs')
const path = require('path')

const main = (dirName) => {
  const dir = path.resolve(__dirname, dirName)
  const files = fs.readdirSync(dir)
  files.forEach(file => {
    const { isDirectory } = fs.statSync(path.join(dir, file))
    if (isDirectory()) {
      console.log(file)
    }
  })
}
main('.')

Operating system

Windows 10

Scope

code

Module and version

Not applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    answered🎉 Yay! The issue has been resolved, or the question has been answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions