Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap error: Cannot find module

I'm trying to create a HelloWorld project but are experiencing an error

phonegap create C:\Desenv\PhoneGap\learn com.cassia.hello HelloWorld

Error:

C:\Users\cassiasantos>phonegap create teste com.cassia.hello HelloWord
module.js:338
    throw err;
          ^
Error: Cannot find module '..\..\node_modules\cordova\node_modules\cordova-lib'
    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> (C:\Users\cassiasantos\AppData\Roaming\npm\node_module
s\phonegap\lib\cordova\index.js:16:26)
    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)
like image 358
csf Avatar asked Jun 08 '15 13:06

csf


2 Answers

It seems that you have to install all the modules - at least this fix worked for me.

Use

sudo npm update -g

Found the solution in an ionic forum.

like image 50
hjpithadia Avatar answered Oct 11 '22 12:10

hjpithadia


this is phonegap bugs. Here is temporary solution

Install cordova-lib under
../node_modules/phonegap/node_modules/cordova

Goto ../node_modules/phonegap/node_modules/cordova

Exec npm install cordova-lib

like image 35
Phipe Teoh Avatar answered Oct 11 '22 12:10

Phipe Teoh