<p dir="auto">This code worked before:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function A () { let a }
function B () { let a }"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-v">A</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-k">let</span> <span class="pl-s1">a</span> <span class="pl-kos">}</span>
<span class="pl-k">function</span> <span class="pl-v">B</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-k">let</span> <span class="pl-s1">a</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">Now I get a TypeError:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: foo.js: Line 2: Duplicate declaration &quot;a&quot;
  1 | function A () { let a }
&gt; 2 | function B () { let a }
    |                     ^
  3 | 
    at File.errorWithNode (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/transformation/file/index.js:436:15)
    at Scope.checkBlockScopedCollisions (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:287:23)
    at Scope.registerBinding (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:424:12)
    at Scope.registerDeclaration (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:384:14)
    at TraversalPath.enter (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:79:13)
    at TraversalPath.call (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/path/index.js:443:26)
    at TraversalPath.visit (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/path/index.js:455:10)
    at TraversalContext.visitMultiple (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/context.js:50:16)
    at TraversalContext.visit (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/context.js:71:19)
    at Function.traverse.node (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/index.js:44:17)
"><pre class="notranslate"><code class="notranslate">TypeError: foo.js: Line 2: Duplicate declaration "a"
  1 | function A () { let a }
&gt; 2 | function B () { let a }
    |                     ^
  3 | 
    at File.errorWithNode (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/transformation/file/index.js:436:15)
    at Scope.checkBlockScopedCollisions (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:287:23)
    at Scope.registerBinding (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:424:12)
    at Scope.registerDeclaration (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:384:14)
    at TraversalPath.enter (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/scope.js:79:13)
    at TraversalPath.call (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/path/index.js:443:26)
    at TraversalPath.visit (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/path/index.js:455:10)
    at TraversalContext.visitMultiple (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/context.js:50:16)
    at TraversalContext.visit (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/context.js:71:19)
    at Function.traverse.node (/usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/traversal/index.js:44:17)

</code></pre></div>
<p dir="auto">Is this a bug, or did block scoping change, or am I going crazy?</p>
<p dir="auto">So to test <code class="notranslate">babel</code>, I ran a bunch of commands:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mkdir babel-test
cd babel-test
echo &quot;export async function foo(){}&quot; &gt; src.js
echo &quot;{ \&quot;presets\&quot;: [ \&quot;es2015\&quot;, \&quot;stage-0\&quot; ] }&quot; &gt; .babelrc
npm i babel-cli@latest -g
npm i babel-preset-es2015@latest
npm i babel-preset-stage-0@latest"><pre class="notranslate"><code class="notranslate">mkdir babel-test
cd babel-test
echo "export async function foo(){}" &gt; src.js
echo "{ \"presets\": [ \"es2015\", \"stage-0\" ] }" &gt; .babelrc
npm i babel-cli@latest -g
npm i babel-preset-es2015@latest
npm i babel-preset-stage-0@latest
</code></pre></div>
<p dir="auto">When I ran <code class="notranslate">babel src.js</code> now, I got the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error: src.js: Expected type &quot;Identifier&quot; with option {}
    at Object.t.(anonymous function) [as assertIdentifier] (C:\Sandbox\babel-test\node_modules\babel-types\lib\index.js:80:13)
    at PluginPass.exports.visitor.Function.exit (C:\Sandbox\babel-test\node_modules\babel-plugin-transform-regenerator\lib\visit.js:78:9)
    at c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\visitors.js:271:19
    at NodePath._call (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:72:18)
    at NodePath.call (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:44:17)
    at NodePath.visit (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:108:8)
    at TraversalContext.visitQueue (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:151:16)
    at TraversalContext.visitMultiple (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:106:17)
    at TraversalContext.visit (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:193:19)
    at Function.traverse.node (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\index.js:139:17)"><pre class="notranslate"><code class="notranslate">Error: src.js: Expected type "Identifier" with option {}
    at Object.t.(anonymous function) [as assertIdentifier] (C:\Sandbox\babel-test\node_modules\babel-types\lib\index.js:80:13)
    at PluginPass.exports.visitor.Function.exit (C:\Sandbox\babel-test\node_modules\babel-plugin-transform-regenerator\lib\visit.js:78:9)
    at c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\visitors.js:271:19
    at NodePath._call (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:72:18)
    at NodePath.call (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:44:17)
    at NodePath.visit (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:108:8)
    at TraversalContext.visitQueue (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:151:16)
    at TraversalContext.visitMultiple (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:106:17)
    at TraversalContext.visit (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\context.js:193:19)
    at Function.traverse.node (c:\Program Files\nodejs\node_modules\babel-cli\node_modules\babel-traverse\lib\index.js:139:17)
</code></pre></div>
<p dir="auto">Since I wasn't sure what had caused the error, I ran <code class="notranslate">babel-doctor</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Babel Doctor
Running sanity checks on your system. This may take a few minutes...

√ Found config at C:\Sandbox\babel-test\.babelrc
√ No duplicate babel packages found

× We found some outdated packages:

- babel-runtime - Latest is 6.0.14. Local version is 5.8.29

√ You're on npm &gt;=3.3.0

Found potential issues on your machine :("><pre class="notranslate"><code class="notranslate">Babel Doctor
Running sanity checks on your system. This may take a few minutes...

√ Found config at C:\Sandbox\babel-test\.babelrc
√ No duplicate babel packages found

× We found some outdated packages:

- babel-runtime - Latest is 6.0.14. Local version is 5.8.29

√ You're on npm &gt;=3.3.0

Found potential issues on your machine :(
</code></pre></div>
<p dir="auto">To fix this, I ran <code class="notranslate">npm i babel-runtime@latest</code>. However, running <code class="notranslate">babel-doctor</code> again produced this output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Babel Doctor
Running sanity checks on your system. This may take a few minutes...

√ Found config at c:\Sandbox\babel-test\.babelrc

× Found these duplicate packages:

- babel-runtime x 61

Recommend running `npm dedupe`

× We found some outdated packages:

- babel-runtime - Latest is 6.0.14. Local version is 5.8.29
/* REMOVED 59 LINES HERE */
- babel-runtime - Latest is 6.0.14. Local version is 5.8.29

√ You're on npm &gt;=3.3.0

Found potential issues on your machine :("><pre class="notranslate"><code class="notranslate">Babel Doctor
Running sanity checks on your system. This may take a few minutes...

√ Found config at c:\Sandbox\babel-test\.babelrc

× Found these duplicate packages:

- babel-runtime x 61

Recommend running `npm dedupe`

× We found some outdated packages:

- babel-runtime - Latest is 6.0.14. Local version is 5.8.29
/* REMOVED 59 LINES HERE */
- babel-runtime - Latest is 6.0.14. Local version is 5.8.29

√ You're on npm &gt;=3.3.0

Found potential issues on your machine :(
</code></pre></div>
<p dir="auto">So I ran <code class="notranslate">npm dedupe babel-runtime</code> and <code class="notranslate">babel-doctor</code> again, but nothing changed.</p>
<p dir="auto">I figured, perhaps I had to update the global module. Before doing this, I first reset the local modules by running <code class="notranslate">rm -rf node_modules</code>, <code class="notranslate">npm i babel-preset-es2015@latest</code> and <code class="notranslate">npm i babel-preset-stage-0@latest</code>. I then ran <code class="notranslate">npm i babel-runtime -g</code> and <code class="notranslate">babel-doctor</code> again, but it still said that <code class="notranslate">babel-runtime</code> was outdated.</p>
<p dir="auto">Now, I don't know what else to do to fix this. Any help is much appreciated. :)</p>