Answers for "__dirname is not defined node js"

6

ReferenceError: __dirname is not defined

import path from 'path';
const __dirname = path.resolve();
Posted by: Guest on June-08-2021
0

Why is dirname not defined in node api?

import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Posted by: Guest on June-26-2021

Code answers related to "__dirname is not defined node js"

Browse Popular Code Answers by Language