简体   繁体   中英

Cordova CLI on Windows8 can't find hooks

I'm trying to compile my phonegap project using the cordova cli on my Win8 machine. I've updated all my Android SDKs, updated cordova and phonegap but I cannot build my project. I get an error that the .cordova/hooks/any_hook is empty.

I looked in that directory and can't see any files in there. How do those files get there and is the latest version of cordova bad? Until now I've been compiling on my Mac because I couldn't get the PC setup correctly so today I decided to take a crack at it and have failed.

I even created a new hello world project using the CLI but still no luck in building the thing because of the supposed missing hook files. Anyone have any insight to this.?

Also, I've tried using the command prompt in both ADMIN and regular mode. Still no luck.

EDIT:

I'm using phonegap 3.3.0-4.18.0

Path to hooks: Z:\\projecttitleroot\\projecttitle.cordova\\hooks

OUTPUT OF PHONEGAP BUILD WITH DEBUG:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[error] ENOENT, no such file or directory 'Z:\myprojectroot\myproject\.cordova\hooks\before_build'

I want to point out that I'm using phonegap command to compile and run, NOT cordova as per the documentation for the latest version.

If I run:

cordova -d build android

I get this:

Z:\myprojectroot\myproject>cordova -d build android

C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
                    throw e;
                      ^
Error: ENOENT, no such file or directory 'Z:\myprojectroot\myproject\.cordova\hooks\before_build'    at Object.fs.readdirSync (fs.js:654:18)
at C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\src\hooker.js:64:34
at _fulfilled (C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:760:13)
at C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:821:14
at flush (C:\Users\MYUSER\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)

Z:\myprojectroot\myproject>

Make sure you put your hooks into subdirectories inside the hooks directory.

Path to hooks: Z:\\projecttitleroot\\projecttitle.cordova\\hooks\\before_build\\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM