Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
hendrik
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany
Accepted Solution

Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

[ Edited ]

I'm trying to set up a BlackBerry 10 project with Cordova/PhoneGap 3.0.0.

 

It took me some time to figure out that the platform guide for BlackBerry 10 actually refers to the version available at http://cordova.apache.org/ and has to be installed in a different way than mentioned on the PhoneGap website's front page.

 

I've successfully created a project and added my Z10 device as a target.

 

However when trying to execute "build debug z10" or "run z10" I always get the following error:

events.js:72 throw er; // Unhandled 'error' event

Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)

 Any solution to this?

----

My Twitter: @hendrik_dev
Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Are yoou using it with native sdk?

Developer
hendrik
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Yes, I've installed the native SDK and all requirements listed in the guide http://docs.phonegap.com/en/edge/guide_platforms_blackberry10_index.md.html#BlackBerry 10 Platform G...:

 

----

My Twitter: @hendrik_dev
Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: Unhandled error when building or running a Cordova/PhoneGap BB10 app

According to me as is seems you don't have any problem with the sdk. I think the root cause of your problem is the USB drivers or the Blackberry device drivers you have installed on your PC. 

Please take a look at the latest USB and device drivers for your current machine and OS. 

Then try connecting your phone.

BlackBerry Development Advisor
bryanhiggins
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Hi,

 

First of all, thank-you for reporting this issue. I'd really like to get to the bottom of it.

 

I understand your frustration with the documentation. There were a bunch of updates and revisions made recently that did not end up getting published. We're working with Apache to get that fixed ASAP.

 

https://issues.apache.org/jira/browse/CB-4347

 

The ./cordova/build command accepts "--debug" and "--release" (debug is the default). ./cordova/run has "--target=z10". If you have only setup one target, it will be the default, so you don't really have to pass it in at all. You can find the exact argument list via "--help".

 

Please try it again and see if you still get that error message. It's something I've not come accross before and could not replicate using the steps you described.

 

As a side note, the new PhoneGap 3.0 does use the same BlackBerry 10 scripts which are in Apache Cordova, but they are called indirectly (in the same way as cordova-cli). You would call "phonegap platform add blackberry10" and then "phonegap run blackberry10".

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Developer
hendrik
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Thank you, this really gives some context to the two different ways to run these scripts.

 

I also tried using the new PhoneGap 3.0. The documentation at http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The Command-line Interface states "cordova platform add blackberry" which was not recognized. I then tried "cordova platform add blackberry10" myself, which was recognized, but resulted in an error. I am not sure if it was the same error I reported in my initial post or a different one. Will have to try this again.

 

Regarding the Apache Cordova scripts, I just followed your suggestion and tried both "build --debug" and simply "run" as well as "run --target z10 --keystorepass [pass]". My Z10 is the only target I have added so far. Unfortunately I still get the same error.

 

This is not specific to Cordova 3.0.0 however. Two other people reported the same error message using version 2.9.0 here:

https://groups.google.com/forum/#!msg/phonegap/oHc6L643GNM/MbcqBeuiaZcJ

 

----

My Twitter: @hendrik_dev
BlackBerry Development Advisor
bryanhiggins
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Hi,


I've logged an issue for this here:

 

https://issues.apache.org/jira/browse/CB-4403

 

Could you please add details about your environment to that?

- OS version

- Node JS version

- Native SDK version

 

Thanks!

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
BlackBerry Development Advisor
bryanhiggins
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

We have tracked down the cause of this error to the BlackBerry NDK tools missing from system path.

 

After installing the BlackBerry Native SDK, its tools must be added to your system path. Either manually add the bin directory to your path or run the following scripts from the directory where you installed the NDK:

 

Windows

bbndk-env.bat

 

Linux/Mac

source bbndk-env.sh

 

Note: running the scripts will only add the tools to your path for the current shell. If you want them to persist, you should add the path to the bin directory using Windows environment settings or Linux/Mac bash profile.

 

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Developer
hendrik
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

Thanks, Bryan. I can confirm that the missing environment variables for the Native SDK were causing this error. Having them set, building and running the app now works fine for me.

----

My Twitter: @hendrik_dev
Developer
ryansweny
Posts: 64
Registered: ‎07-15-2008
My Device: Z10

Re: Unhandled error when building or runnning a Cordova/PhoneGap BB10 app

On some machines the bb_ndk-env.bat file is broken too. I had to replace the first line:

 

set BASE_DIR=%~dp0

 

with:

 

set BASE_DIR=c:\devel\bbndk

 

After running the bat file type echo %PATH% and make sure it looks sane.