title: Getting error "babel" is not recognized as an internal or external command,
body: <p>I have a simple tests.js file that I wish to follow up with a source map file. I have tried initiating the dependencies yet the prompt shows the error. If anyone could specify the problem and the solution would be grateful ^^</p>
  <p><strong>tests.js</strong></p>
  <pre><code>var add = (...arr) =&gt; {
      return arr.reduce((sum, el) =&gt;{
          return sum+el;
      }, 0)
  }
  console.log(add(1,2,3));
  </code></pre>
  <p>I've tried these commands at first</p>
  <p><code>npm install -g babel-cli</code></p>
  <p><code>npm install babel-preset-es2015</code></p>
  <p><code>babel tests.js --out-file tests.dist.js --source-maps --presets=es2015</code></p>
  <p>But received the same error. I have followed another solution from the community but it still didn't work. The solution was to remove node_modules and reinitiate the dependencies.</p>
  <p><code> npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/node</code></p>
  <p>and add <code>&quot;start&quot;: &quot;nodemon --exec babel-node index.js&quot;,</code> in the dependencies.
  I checked the node_modules and it had the existence of these files too.</p>
  <p>node_modules/.bin/babel-node</p>
  <p>node_modules/.bin/babel-node.cmd - windows only</p>
  <p>node_modules/@babel/node/bin/babel-node.js</p>
  <p><a href="https://stackoverflow.com/a/65827691/15752791">The solution I followed</a> Still, I couldn't figure out how to solve this issue. This is my first time working with node and babel. My node version is <code>v16.13.1</code></p>
  <p><strong>Edited</strong></p>
  <p><strong>Folder Structure</strong></p>
  <pre><code>Y:.
  |   index.html
  |   package-lock.json
  |   package.json
  |   tests.js
  |   tree.txt
  |   
  \---node_modules
      |   .package-lock.json
      |   
      +---.bin
      |       babel
  .....
  </code></pre>
  <p>It's huge!</p>
  <p><strong>package.json</strong></p>
  <pre><code>{
    &quot;dependencies&quot;: {
      &quot;@babel/cli&quot;: &quot;^7.16.8&quot;,
      &quot;@babel/core&quot;: &quot;^7.16.12&quot;,
      &quot;@babel/preset-env&quot;: &quot;^7.16.11&quot;
    }
  }
  </code></pre>
  <p><strong>.babelrc</strong></p>
  <pre><code>{
      &quot;presents&quot;: [
          &quot;@babel/preset-env&quot;
      ]
  }
  </code></pre>
  <p><strong>./node_modules/@babel/cli/bin/babel.js</strong></p>
  <pre><code>require(&quot;../lib/babel&quot;);
  </code></pre>
  <p><strong>After using bash for the command -</strong></p>
  <p><code>./node_modules/@babel/cli/bin/babel.js example.js --out-file main.dist.js</code></p>
  <p><strong>The error</strong></p>
  <pre><code>Error: Unknown option: .presents. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
      at throwUnknownError (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:133:27)
      at Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:118:5
      at Array.forEach (&lt;anonymous&gt;)
      at validateNested (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:94:21)
      at validate (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:85:10)
      at Y:\babel work\node_modules\@babel\core\lib\config\config-chain.js:209:34
      at cachedFunction (Y:\babel work\node_modules\@babel\core\lib\config\caching.js:60:27)
      at cachedFunction.next (&lt;anonymous&gt;)
      at evaluateSync (Y:\babel work\node_modules\gensync\index.js:251:28)
      at sync (Y:\babel work\node_modules\gensync\index.js:89:14) {
    code: 'BABEL_UNKNOWN_OPTION'
  }
  </code></pre>