March 2016 articles

Resolving permissions error for Apache Cordova command line usage

Posted: Tuesday 29th March, 2016 - 7:12pm
Author: James Griffiths

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:

				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...


Resolving cannot find NPM module error when installing cordova plugins

Posted: Friday 25th March, 2016 - 7:08pm
Author: James Griffiths

After updating both the local Ionic and Cordova versions for an iOS project we encountered the following error while attempting to install some Cordova plugins from the command line:

    throw err;
Error: Cannot find module 'bplist-parser'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object. (/Users/joebloggs/.nvm/v0.10.26/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js:20:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Not a good sign!

Thankfully the fix to this takes less than a few seconds to implement...


Viewing Gulp tasks from the command line

Posted: Thursday 24th March, 2016 - 7:03pm
Author: James Griffiths

There's no denying that front-end development workflow has been improved greatly with tasks runners such as Grunt and Gulp.

Here's a nice little tip on being able to view all Gulp related tasks directly from the command line...


Suppressing JSHint mixed spaces and tabs warning

Posted: Thursday 24th March, 2016 - 7:01pm
Author: James Griffiths

If you've been using JSHint for an extended period of time you may have encountered warnings being printed to the console akin to the following:

scripts.js: line 23, col 1, Mixed spaces and tabs.
scripts.js: line 44, col 1, Mixed spaces and tabs.

This warning occurs as JSHint will not allow spaces and tabs to be used together.

Switching this off is quite easy...