ionic-cli: Error: Cannot find module 'xmlbuilder'

Hi, I’m using mac os yosemite and tried to install ionic.

First I’ve installed Node.js 4 and then

sudo npm install -g cordova ionic

Installation succeeded and I tried to create blank app:

ionic start myApp blank

However I got following error:

module.js:327 throw err; ^

Error: Cannot find module ‘xmlbuilder’ at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:12:13) at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:436:4) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 45 (9 by maintainers)

Most upvoted comments

I had the same issue. http://stackoverflow.com/questions/22603078/syntaxerror-use-of-const-in-strict-mode - this helped:

  1. Clear NPM’s cache:

sudo npm cache clean -f

  1. Install a little helper called ‘n’

sudo npm install -g n

  1. Install latest stable NodeJS version

sudo n stable

@sn0opr, I solved it on my ubuntu 14.04 by change nodejs version to v4.3.1 I hope that help

solved it for me: npm cache clean npm install -g ionic cordova

Thanks for help!!

First of I followed @sparber instructions (removed nodejs using this script: https://gist.github.com/TonyMtz/d75101d9bdf764c890ef)

Then I installed ionic using this command:

sudo npm install -g ionic@beta cordova --unsafe-perm

Without unsafe-perm I was getting access denied errors (even with sudo).

And it worked!

@sn0opr Thanku for information i will try…

@vigneshmuthukrishnan try to remove the the node_modules folder and reinstall again

Hello, a tried every single solution, this is what worked for me

inside

  1. /user/local/lib/node_module //or where your node_module directory is, you has to locate ionic module

  2. cd ionic

from there install the dependency locally,
3) sudo npm install -d xmlbuilder

I guarantee it will work like a charm.

On Ubuntu 14.04 these steps helped.

I resolved it by just doing it in docker :-p

I had the same issue on ubuntu.

I solved it by:

removing nodejs, deleting the /usr/lib/node_modules (/usr/local/lib/node_modules) folder reinstalling nodejs, clearing the npm cache (npm cache clean) reinstalling ionic

I hope that helps