Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap Error + Error: Cannot find module 'q'

Trying to build phonegap app but strange error :-

user@ubuntu:~/Projects/PhoneGap/testapp$ phonegap build android
[phonegap] executing 'cordova build android'...
Running command: /home/user/Projects/PhoneGap/testapp/platforms/android/cordova/build 

module.js:338
    throw err;
          ^
Error: Cannot find module 'q'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/user/Projects/PhoneGap/testapp/platforms/android/cordova/lib/spawn.js:23:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

You may not have the required environment or OS to build this project

cordova -v => 5.3.3

wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"}

Please suggest something .. Thanks

like image 221
Rubyist Avatar asked Oct 30 '15 18:10

Rubyist


2 Answers

I was struggling with same issue and finally figure out npm install q --save helps me.

like image 193
Vova Bilyachat Avatar answered Nov 09 '22 23:11

Vova Bilyachat


I had the same issue because my cordova android version was deprecated. Upgrade with

cordova platform update android

as described here: https://cordova.apache.org/docs/en/3.1.0/guide/platforms/android/upgrading.html

like image 28
alx60531 Avatar answered Nov 09 '22 23:11

alx60531