How to fix the "Access denied to config file" error when using Netlify CLI.
Lately I installed the Netlify CLI in MacOS with the help of npm:
npm install -g netlify-cli
After trying to run the netlify commands in a project I faced the following error:
Error: EACCES: permission denied, open '/Users/[MacOSUserName]/Library/Preferences/netlify/config.json.4530239472' You don't have access to this file.
After a while of researching I found a solution for my case on Github.
The following three commands fixed the error for me:
sudo rm -rf /Users/[YourMacOSUserName]/Library/Preferences/netlify/
npm install -g netlify-cli
ntl login