title: npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! Unexpected token '.'
body: <pre><code>npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
  npm ERR! Unexpected token '.'
  </code></pre>
  <p>Everything was working well in my machine. but suddenly npm/npx started throwing the above error.</p>
  <p><strong>I'm getting the same error for every npm commands.</strong></p>
  <p>system config:</p>
  <ul>
  <li><p>OS: Windows 10</p>
  </li>
  <li><p>Node V :  v16.15.1</p>
  </li>
  <li><p>npm v : 8.11.0</p>
  </li>
  </ul>
  <p>I have tried below solutions so far:</p>
  <ol>
  <li>npm cache clean --force (throwing the same error)</li>
  <li>ran commands with <em>--location=global</em></li>
  <li>modified npm and npm.cmd file by replacing <em>prefix -g</em> with <em>prefix --location=global</em></li>
  </ol>