I keep getting the following errors:
Error: EACCES, permission denied \'/Users/Anuraag/.cordova/lib/tmp\' .
Whenever I try to do cordova
This was what worked for me:
sudo chown -R $USER:$(id -gn $USER) /Users/YOURUSERNAME/.config
The error you have received is from NPM (since the Cordova CLI is installed via NPM). This is a tricky issue where using NPM with sudo
, and then not using sudo
will result in weird permission issues.
If you followed the instructions on the Cordova documentation, it has you install Cordova using sudo
. It then has you do this:
# To ensure permissions are correct, run this command on Mac or Linux, changing LOGIN to match your account name:
$ sudo chown -R LOGIN /usr/local/lib/node_modules/cordova
Did you do that step? If not try it. If that doesn't work, make sure the '/Users/Anuraag/.cordova/lib/tmp'
directory can be accessed. Given that it is a local temporary directory, there is most likely no harm in giving it full read/write access with something like:
chmod -R 777 '/Users/Anuraag/.cordova/lib/tmp'
For me worked:
sudo chown -R LOGIN ~/.config/configstore/update-notifier-cordova.json
Also I am using nvm which separates spaces and makes easier to maintain an app.
After trying every single solution here I had to BEGRUDGINGLY reinstall ionic
npm i -g ionic
Begrudgingly because my plan was to upgrade ionic to see what would break but first I wanted to run it at the current version first to see if everything still worked.
The only thing that worked for me was to uninstall cordova and ionic, then go into the user folder and deleting the hidden files .cordova and .ionic files using sudo permissions. Then reinstall cordova and ionic.
Similar to jasmo2, this worked for me:
sudo chown -R LOGIN ~/.config/configstore