Search code examples
cordovacordova-cli

Phonagap and Cordova cli not working


My problem is a little bit weird, I installed phonegap and cordova cli step by step from the official tutorial and when I try to use phonegap create or something else on my Ubuntu 14.04, but the terminal is not write anything and then waiting for the next command.

Example#1:

expa@a42book:~$ cordova add platform android
expa@a42book:~$ 

Example#2:

expa@a42book:~$ cordova platform add android
expa@a42book:~$ 

I could only this way:

expa@a42book:~$ sudo nodejs /usr/local/lib/node_modules/cordova/bin/cordova platform add android

Someone has pulled into this problem and solved it?


Solution

  • The problem was with my cordova install (and the command too), I followed this tutorial: http://jeffmcmahan.info/blog/installing-cordova-on-linux/ and it began to working.

    If that’s you, start by removing node.js as follows:

    $ sudo apt-get remove node

    Next, you’ll fix up up some Python dependencies:

    $ sudo apt-get install python-software-properties python g++ make

    And now we’ll add the proper repo for up-to-date releases of Node.js, and then we’ll run an update to grab the list of packages required to install node:

    $ sudo add-apt-repository ppa:chris-lea/node.js

    $ sudo apt-get update

    We can now install Node.js itself:

    $ sudo apt-get install nodejs

    Finally, we install Cordova.

    $ sudo npm install -g cordova