title: nodeJS path module can't resolve the directory path
body: <p>I want to create a CLI for bootstrap my project. Everything works find but in order to copy my template files I use <a href="https://www.npmjs.com/package/ncp" rel="nofollow noreferrer">ncp</a> where I give the template directory as a argument. So I tried,</p>
  <pre class="lang-js prettyprint-override"><code>import chalk from 'chalk';
  import path from 'path';
  import fs from 'fs';
  import { promisify } from 'util';
  const access = promisify(fs.access);
  ...
  const templateDir = path.resolve(
      new URL(import.meta.url).pathname,
      '../../templates',
      'project_name'
    );
  
    try {
      await access(templateDir, fs.constants.R_OK);
    } catch (err) {
      console.error('%s Invalid template name', chalk.red.bold('ERROR'));
      process.exit(1);
    }
  ...
  </code></pre>
  <p>I got <code>ERROR Invalid template name</code></p>
  <p>Then I tried to figure out the problem,</p>
  <pre class="lang-js prettyprint-override"><code> //* after getting ERROR Invalid template name
    //* checking file exist or not
    fs.stat(templateDir, function (err, stat) {
      if (err == null) {
        console.log('File exists');
      } else if (err.code === 'ENOENT') {
        // file does not exist
        console.log(&quot;file doesn't exit&quot;);
      } else {
        console.log('Some other error: ', err.code);
      }
    });
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>file doesn't exit
  [Error: ENOENT: no such file or directory, access 'G:\G:\CLI%20project\create-project\templates\javascript'] {
    errno: -4058,
    code: 'ENOENT',
    syscall: 'access',
    path: 'G:\\G:\\CLI%20project\\create-project\\templates\\javascript'
  }
  ERROR Invalid template name
  </code></pre>
  <p>I expect the access should be <code>G:\CLI%20project\create-project\templates\javascript</code> but it's not giving the that. where was the wrong happened? by the way I use <a href="https://www.npmjs.com/package/esm" rel="nofollow noreferrer">esm</a> module loader.</p>