Random thoughts & observations

From the mundane to the profound and everything in between here’s what’s rocking our world

Resolving permissions error for Apache Cordova command line usage

Posted: March 29, 2016
Written by: Saints At Play
Category: PhoneGap

We found, after a recent Apache Cordova upgrade, that every time we tried to run Cordova commands in the Terminal we'd receive the following error message:

/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
				throw err;
				      ^
Error: EACCES, permission denied '/Users/name-here/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:502:18)
    at Object.fs.readFileSync (fs.js:354:15)
    at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
    at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
    at new UpdateNotifier (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
    at module.exports (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
    at checkForUpdates (/usr/local/lib/node_modules/cordova/src/cli.js:64:20)
    at cli (/usr/local/lib/node_modules/cordova/src/cli.js:116:5)
    at Object. (/usr/local/lib/node_modules/cordova/bin/cordova:41:1)

Definitely not a good sign!

Thankfully, fixing this is quite straightforward...

In your Terminal (this presumes you are using a Unix based OS) simply type the following command (substituting yourusername for the user name of your system account):

sudo chown -R yourusername /Users/yourusername/.config/configstore/

Doing this will allow you to change the ownership permissions on the configstore directory (and ALL files/sub-directories contained within through use of the -R flag) which, in turn, allows you to subsequently execute commands using the cordova CLI utility.

Hopefully this helps any developers out there who are encountering the same issue.

« Return to Posts

Comments

There are no comments

Posting comments after three months has been disabled.