paulo.pinda
paulo.pinda

Reputation: 41

Cordova run ubuntu not work

I installed Ubuntu 14.04 and I can not run application using the "cordova run ubuntu", gives the following error :

paulo@paulo-notebook:~/hello$ sudo cordova run ubuntu
ReferenceError: name is not defined
    at Object.ConfigParser.setDescription (/usr/local/lib/node_modules/cordova/src/ConfigParser.js:70:45)
    at Object.module.exports.update_from_config (/usr/local/lib/node_modules/cordova/src/metadata/ubuntu_parser.js:74:21)
    at Object.module.exports.update_project (/usr/local/lib/node_modules/cordova/src/metadata/ubuntu_parser.js:156:21)
    at /usr/local/lib/node_modules/cordova/src/prepare.js:113:31
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:821:14
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

And earlier also gives the following error when doing "cordova platform add ubuntu"

paulo@paulo-notebook:~/hello$ cordova platform add ubuntu
Downloading cordova library for ubuntu...
Download complete
Checking ubuntu requirements...
Running "dpkg-query -Wf'${db:Status-abbrev}' cmake debhelper libx11-dev libicu-dev pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev qtpim5-dev qtsensors5-dev qtsystems5-dev 2>/dev/null | grep -q '^i'" (output to follow)

Creating ubuntu project...
Shelljs module was not found, running 'npm install'.....
ReferenceError: name is not defined
    at Object.ConfigParser.setDescription (/usr/local/lib/node_modules/cordova/src/ConfigParser.js:70:45)
    at Object.module.exports.update_from_config (/usr/local/lib/node_modules/cordova/src/metadata/ubuntu_parser.js:74:21)
    at Object.module.exports.update_project (/usr/local/lib/node_modules/cordova/src/metadata/ubuntu_parser.js:156:21)
    at /usr/local/lib/node_modules/cordova/src/prepare.js:113:31
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:821:14
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

Does anyone know what can be ?

Upvotes: 1

Views: 1102

Answers (2)

Adam Fónagy
Adam Fónagy

Reputation: 101

This is a JavaScript bug of Cordova that you can fix by following next steps

$ sudo vim /usr/local/lib/node_modules/cordova/src/ConfigParser.js

Go to line 69. Here you'll find this:

setDescription: function() {
    this.doc.find('description').text = name;
    var el = findOrCreate(this.doc, 'description');
},

The problem is in line 70 caused by the variable called name: it is undefined. To fix this bug you need to add name as an input parameter of the setDescription function, like this:

setDescription: function(name) {
    this.doc.find('description').text = name;
    var el = findOrCreate(this.doc, 'description');
},

Save your changes. Since the Ubuntu platform has been added - I assume incorrectly - you should go into the platforms directory of your Cordova project and delete the ubuntu directory

$ cd ~/hello/platforms
$ rm -r ubuntu

Now you need to rerun:

$ cordova platform add ubuntu

Finally it should run without errors.

I've opened an issue about it to Apache Software Fundation: https://issues.apache.org/jira/browse/CB-6643

Upvotes: 2

hkazemi
hkazemi

Reputation: 708

The correct syntax is cordova run "supported platforms" /cordova add "supported platforms" . And ubunto is not a supported platform.

Have a look at this page: Apache Cordova Documentation - The Command-line Interface

Supported platforms are:

  • iOS
  • Android
  • BlackBerry
  • Windows Phone 8

For example: cordova add android / cordova run wp8 , ....

Upvotes: 1

Related Questions