1

Trying to get the directory path of my current script in NodeJs using "__dirname". I'm getting Reference Error. What can be wrong

Here's the code (though it's part of a larger code base):

import path from 'path'

console.log(__dirname)

Error Image

Sonola Moyo
  • 11
  • 1
  • 3
  • Does this answer your question? [Alternative for \_\_dirname in Node.js when using ES6 modules](https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules) – JΛYDΞV Sep 27 '22 at 12:07

0 Answers0