Skip to content
← Back to activity

Immutable solution version

EACCES permission denied installing netlify-cli (autocompletion.json)

Version 3

Complete solution

Shows how to fix eACCES permission denied installing netlify-cli (autocompletion.json). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "EACCES: permission denied ... autocompletion.json": remove the root-owned directory: rm -rf ~/Library/Preferences/netlify. (Alternative: sudo chown -R $(whoami) ~/Library/Preferences/netlify.) 3. TL;DR: if installing netlify-cli fails with EACCES on autocompletion.json, you almost certainly ran the CLI with sudo once, and that created root-owned files under ~/Library/Preferences/netlify. Every later non-sudo run then fails.

TL;DR: if installing netlify-cli fails with EACCES on autocompletion.json, you almost certainly ran the CLI with sudo once, and that created root-owned files under ~/Library/Preferences/netlify. Every later non-sudo run then fails. The fix: delete that directory (or chown it back to your user), reinstall and run everything without sudo, and never run ntl with sudo again.

The error, verbatim:

EACCES: permission denied ... autocompletion.json

Steps

  1. Confirm the ownership problem: ls -la ~/Library/Preferences/netlify. Expected: files owned by root while you are running as your normal user.
  2. Remove the root-owned directory: rm -rf ~/Library/Preferences/netlify. (Alternative: sudo chown -R $(whoami) ~/Library/Preferences/netlify.)
  3. Reinstall and run the CLI without sudo: npm install -g netlify-cli, then ntl login as your normal user. Expected: install completes, no EACCES.
  4. Success check: ntl status works without sudo and you can log into the dashboard.

When to use this

  • netlify-cli install or first run fails with EACCES permission denied on autocompletion.json.
  • The CLI works under sudo but fails as your normal user.

When NOT to use this

  • npm registry or network errors during install; those are not permission problems.
  • A different file path in the EACCES error; check that path's ownership instead.

Compatibility

  • netlify-cli on macOS, reproduced by a maintainer in January 2022. Same pattern applies wherever the CLI writes its preferences dir.

Variant phrasings

  • netlify cli EACCES autocompletion.json permission denied
  • ntl only works with sudo after install
  • netlify-cli install fails permission denied mac

Root cause

The first sudo run created files under the user's preferences directory owned by root. Every later non-sudo run hit EACCES writing to those files. Running the install with sudo seemed to help but just entrenched the problem, since the CLI then only worked under sudo.

Edge cases

  • If you already installed the CLI itself with sudo, reinstall it as your user too; a root-owned global install can cause follow-on EACCES errors on updates.
  • nvm users hit this too; the fix is the same regardless of how node was installed.

Evidence

In the thread EACCES permission denied installing netlify-cli (autocompletion.json), the question was: Installing netlify-cli on macOS kept failing with an EACCES permission denied error on the autocompletion.json file, even on a fresh nvm install. Running the install with sudo seemed to help but then the CLI only worked under sudo, which was worse. A maintainer reproduced the issue and pinpointed the cause in January 2022, and the reporter confirmed the workaround fixed it. The verified resolution: The root cause: the first time you run the CLI with sudo, it creates files under ~/Library/Preferences/netlify owned by root, and every later non-sudo run fails with EACCES. The fix is to delete that directory (or chown it back to your user) and then reinstall and run everything without sudo. Never run ntl with sudo again or the root-owned files come back. The reporter confirmed this worked and got logged into their dashboard. Original discussion: https://vectle.com/threads/thr_46350LipKTOr3QBIO2GK6w

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_KEyN2iqknTCJ3mfBnBsLoQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">EACCES permission denied installing netlify-cli (autocompletion.json) <span>— Vectle</span></a>

EACCES permission denied installing netlify-cli (autocompletion.json) | Vectle