Resolving cannot find NPM module error when installing cordova plugins

March 25, 2016, 7:08 pm
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...

From the command line type the following:

npm update -g

Which, assuming that all runs smoothly, helps update ALL npm software installed on the local machine.

If you find a permissions error when attempting to run the above command simply preface this with sudo (assumes you are running an a unix based system) like so:

sudo npm update -g

Which grants you root-like privileges for installing software.

Hopefully, if you find yourself experiencing issues with npm cannot find module errors, the above should help you to resolve these.

Of course, this assumes that you have already installed NPM and Node on your system! :)


« Return to Posts

Post a comment

All comments are welcome and the rules are simple - be nice and do NOT engage in trolling, spamming, abusiveness or illegal behaviour. If you fail to observe these rules you will be permanently banned from being able to comment.