You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "John M. Wargo" <jw...@gmail.com> on 2014/09/22 18:46:01 UTC

Node Hook?

Is there anything special I have to do to run a node app as a hook on Windows?

I was experimenting with this yesterday on Cordova 3.5, and when I have the following hook as a before prepare:

     #! /usr/bin/env node
     console.log('this is a node module');

I get the following error:

     The system cannot find the path specified.
     Hook failed with error code 1: C:\Users\jwargo\dev\lunchmenu\hooks\before_prepare\test.js

So it's seeing the hook and not 'finding' it?

On Stack Overflow, the suggestion was to remove the first line and just have the console line:

     console.log('this is a node module');

When I do that, I get a different error:

     Hook failed with error code Unknown system errno 193: C:\Users\jwargo\dev\lunchmenu\hooks\before_prepare\test.js

-- 
John M. Wargo
@johnwargo <http://twitter.com/johnwargo>
www.johnwargo.com <http://www.johnwargo.com>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Re: Node Hook?

Posted by "John M. Wargo" <jw...@gmail.com>.
That was it - the space in the shebang.

Thanks so much!!!

On 9/22/2014 1:02 PM, Mark Koudritsky wrote:
> Looks like cordova couldn't find where node is on your system. On Windows
> cordova is doing some hackish magic to deal with shebang lines. The code
> for this magic is in extractSheBangInterpreter
> <https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/hooker.js#L87>.
> Not
> sure, but it looks like you have a space after #! in your shebang line and
> the regexp in extractSheBangInterpreter is not expecting it.
>
> On Mon, Sep 22, 2014 at 12:46 PM, John M. Wargo <jw...@gmail.com> wrote:
>
>> Is there anything special I have to do to run a node app as a hook on
>> Windows?
>>
>> I was experimenting with this yesterday on Cordova 3.5, and when I have
>> the following hook as a before prepare:
>>
>>      #! /usr/bin/env node
>>      console.log('this is a node module');
>>
>> I get the following error:
>>
>>      The system cannot find the path specified.
>>      Hook failed with error code 1: C:\Users\jwargo\dev\lunchmenu\
>> hooks\before_prepare\test.js
>>
>> So it's seeing the hook and not 'finding' it?
>>
>> On Stack Overflow, the suggestion was to remove the first line and just
>> have the console line:
>>
>>      console.log('this is a node module');
>>
>> When I do that, I get a different error:
>>
>>      Hook failed with error code Unknown system errno 193:
>> C:\Users\jwargo\dev\lunchmenu\hooks\before_prepare\test.js
>>
>> --
>> John M. Wargo
>> @johnwargo <http://twitter.com/johnwargo>
>> www.johnwargo.com <http://www.johnwargo.com>
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------
>>


Re: Node Hook?

Posted by Mark Koudritsky <ka...@google.com>.
Looks like cordova couldn't find where node is on your system. On Windows
cordova is doing some hackish magic to deal with shebang lines. The code
for this magic is in extractSheBangInterpreter
<https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/hooker.js#L87>.
Not
sure, but it looks like you have a space after #! in your shebang line and
the regexp in extractSheBangInterpreter is not expecting it.

On Mon, Sep 22, 2014 at 12:46 PM, John M. Wargo <jw...@gmail.com> wrote:

> Is there anything special I have to do to run a node app as a hook on
> Windows?
>
> I was experimenting with this yesterday on Cordova 3.5, and when I have
> the following hook as a before prepare:
>
>     #! /usr/bin/env node
>     console.log('this is a node module');
>
> I get the following error:
>
>     The system cannot find the path specified.
>     Hook failed with error code 1: C:\Users\jwargo\dev\lunchmenu\
> hooks\before_prepare\test.js
>
> So it's seeing the hook and not 'finding' it?
>
> On Stack Overflow, the suggestion was to remove the first line and just
> have the console line:
>
>     console.log('this is a node module');
>
> When I do that, I get a different error:
>
>     Hook failed with error code Unknown system errno 193:
> C:\Users\jwargo\dev\lunchmenu\hooks\before_prepare\test.js
>
> --
> John M. Wargo
> @johnwargo <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>