import path from 'path'; import fs from 'fs'; fs.mkdirSync(path.join(__dirname, 'folderName')); I want to create directories in node, when I require the modules (commonjs) everything works but when I change the type in my package.json to module and use imports the folder doesn't get created, what could I be doing wrong?
__dirnamein an ESM module. You will have to manufacture it fromimport.meta.url. You can search and find examples for how to do that. For examples, see here.