I am installing Apache Cordova on Ubuntu 13.10, following these instructions: http://cordova.apache.org/docs/en/3.5.0//guide_cli_index.md.html#The%20Command-Line%20Interface
I got stuck on the section "Add Platforms":
$ cordova platforms ls
Installed platforms:
Available platforms: amazon-fireos, android, blackberry10, firefoxos, ubuntu
looks like Ubuntu is available. So I proceed.
$ cordova platform add ubuntu
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)
Make sure you have the following packages installed:
user@host:/opt/lampp/htdocs/hello$
looks already strange, since it warns me to install packages given an empty list.
$ cordova build
No platforms added to this project. Please use `cordova platform add <platform>`.
... and it did not work.
$ cordova platforms ls
Installed platforms:
Available platforms: amazon-fireos, android, blackberry10, firefoxos, ubuntu
looks like before.
Any ideas?
supplement:
with
$ cordova -d platform add ubuntu
I get the following:
CordovaError: Make sure you have the following packages installed:
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ubuntu_parser.js:56:22
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:1727:7
at ChildProcess.exithandler (child_process.js:651:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Socket.<anonymous> (child_process.js:968:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
supplement 2:
Ok, I added all missing libraries by sudo apt-get install ......
Now I get this:
$ cordova -d platform add ubuntu
cordova library for "ubuntu" already exists. No need to download. Continuing.
Checking if platform "ubuntu" passes minimum requirements...
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...
Running command: /home/user/.cordova/lib/ubuntu/cordova/3.5.0/bin/create /opt/lampp/htdocs/hello/platforms/ubuntu com.example.hello HelloWorld
Shelljs module was not found, running 'npm install'.....
ERROR : running 'npm install' is npm installed? Error: Command failed: npm WARN package.json [email protected] No README data
npm ERR! Error: Attempt to unlock [email protected], which hasn't been locked
npm ERR! at unlock (/usr/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR! at cb (/usr/lib/node_modules/npm/lib/cache/add-named.js:32:5)
npm ERR! at /usr/lib/node_modules/npm/lib/cache/add-named.js:41:20
npm ERR! at /usr/lib/node_modules/npm/lib/utils/locker.js:30:7
npm ERR! at /usr/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at OpenReq.Req.done (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
npm ERR! at OpenReq.done (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.11.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/user/.cordova/lib/ubuntu/cordova/3.5.0/bin
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! Error: Attempt to unlock elementtree@*, which hasn't been locked
npm ERR! at unlock (/usr/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR! at cb (/usr/lib/node_modules/npm/lib/cache/add-named.js:32:5)
npm ERR! at /usr/lib/node_modules/npm/lib/cache/add-named.js:41:20
npm ERR! at /usr/lib/node_modules/npm/lib/utils/locker.js:30:7
npm ERR! at /usr/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at OpenReq.Req.done (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
npm ERR! at OpenReq.done (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
....[several other lines with similar errors].....
Command finished with error code 1: /home/user/.cordova/lib/ubuntu/cordova/3.5.0/bin/create /opt/lampp/htdocs/hello/platforms/ubuntu,com.example.hello,HelloWorld
Error: /home/user/.cordova/lib/ubuntu/cordova/3.5.0/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
And yes, npm IS installed
solved by changing the ownership of /home/user/.npm from "root" to "user"
Still, the next problem occurs:
$ cordova build
Running command: /opt/lampp/htdocs/hello/platforms/ubuntu/cordova/build
/opt/lampp/htdocs/hello/platforms/ubuntu/cordova/check_reqs
Error: missing dependency cmake libicu-dev pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev qtpim5-dev qtsensors5-dev qtsystems5-dev
/opt/lampp/htdocs/hello/platforms/ubuntu/cordova/check_reqs FAILED
Error: /opt/lampp/htdocs/hello/platforms/ubuntu/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
And I DO have installed these: cmake libicu-dev pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev qtpim5-dev qtsensors5-dev qtsystems5-dev
The error message looks broken but this are the deps you need:
cmake libicu-dev pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev qtpim5-dev qtsensors5-dev qtsystems5-devAt least according to this github link: link
You might want to add
-dwhen executing the add platform code for extra debug info like socordova -d platform add ubuntuedit:
After question from below: You can call
apt-get install <insert package list>to install the packages.edit2:
Again more info after the comment. Not really sure why it is failing as it seems you do have npm installed right?
You can execute the following from where you are calling the create command, it is not the right place but will probably make it work