Problem
Lines of code looks like this
js
import path from 'path'
path.join(__dirname, 'children')will produce the error
js
ReferenceError: __dirname is not defined in ES module scopeSolution
Update your code looks like this
js
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
path.join(__dirname, 'children')


