gal
gal

Reputation: 779

Ionic installation after Ionic2 installation

I tried to install Ionic2 with no success, so I decided to go back to Ionic but during the process something went bad and I can't re-installl the ionic and cordova.

after sudo npm install -g cordova ionic, I tried to run ionic and got:

xx@xxx:~/dev$ ionic info
module.js:328
    throw err;
    ^

Error: Cannot find module 'xmlbuilder'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354: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:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

my versions are:

xx@xxx:~/dev$ npm -v
2.14.12
gal@xxx:~/dev$ nodejs -v
v0.10.25
xx@xxx:~/dev$ node -v
v4.2.6

Upvotes: 1

Views: 3258

Answers (6)

Mike Bessonov
Mike Bessonov

Reputation: 686

Cleaning the npm cache helped in my case. The actions required were:

  1. Install a stable version of nodejs depending of your OS follow these instructions.

  2. Remove all installed versions of cordova and ionic:

    sudo npm uninstall -g ionic cordova bower
    
  3. Critically, clean the npm cache:

    npm cache clean
    
  4. Install from scratch:

    sudo npm install bower cordova ionic -g
    

NOTE: Do not install nodejs version from Ubuntu 14.04 LTS repository because is outdated.

Upvotes: 1

Anh Vuong Tuan
Anh Vuong Tuan

Reputation: 51

You should check your version of nodejs. Make sure that it's version 4. If not, uninstall nodejs and install ver 4. Goodluck! P/s: Uninstall:

sudo apt-get remove nodejs

Install:

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Upvotes: 0

xrexonx
xrexonx

Reputation: 21

I also encountered that issue. What I did was:

$ cd /usr/local/lib/node_modules/ionic/
$ npm install xmlbuilder

You may also use sudo

It just happens that xmlbuilder is a dependency of xml2js and cannot load the module because it wasn't included in the ionic's package.json of the upon installing ionic.

Upvotes: 2

Ahmad Baracat
Ahmad Baracat

Reputation: 480

What worked for me was to use

sudo npm install -g ionic@beta  cordova

to install the V2 version according to link.

Upvotes: 1

AishApp
AishApp

Reputation: 4162

I faced similar issues while downloading ionic 2. Try to install node version 4.2.3 and cordova version 5.4.1 first and then install ionic

  • For ionic v2, npm install -g ionic@beta
  • For ionic v1, npm install -g ionic

Upvotes: 0

Raphael
Raphael

Reputation: 1708

Have you tried to

sudo npm uninstall -g ionic
sudo npm install -g ionic

Upvotes: 0

Related Questions