title: Error: EACCES: permission denied; cannot mkdir
body: <p>I attempted to run a local hardhat project, but came across this problem:</p>
  <pre><code>➜  hardhat sudo npx hardhat accounts                          
  An unexpected error occurred:
  
  Error: EACCES: permission denied, mkdir '/root/.config/hardhat-nodejs'
      at Object.mkdirSync (node:fs:1336:3)
      at Object.mkdirsSync (/home/hxq/hardhat/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
      at getConfigDirSync (/home/hxq/hardhat/node_modules/hardhat/src/internal/util/global-dir.ts:21:6)
      at hasConsentedTelemetry (/home/hxq/hardhat/node_modules/hardhat/src/internal/util/global-dir.ts:103:21)
      at main (/home/hxq/hardhat/node_modules/hardhat/src/internal/cli/cli.ts:147:70) {
    errno: -13,
    syscall: 'mkdir',
    code: 'EACCES',
    path: '/root/.config/hardhat-nodejs'
  }
  </code></pre>
  <p>I tried many solutions, including:</p>
  <pre><code>sudo npm install -g appium --unsafe-perm=true --allow-root
  </code></pre>
  <p>and</p>
  <pre><code>sudo chmod a+w /root/.config
  </code></pre>
  <p>but both didn't work for me.
  I'm a beginner in Nodejs, and want a soluion and, hopefully, its theoretical explaination</p>