Lam, definitely read up on how modules work, but the questions you were
asking are more related to how "packages" work (as in, a collection of
modules in a directory tree). The heart of how packages work is the
package.json file, which describes, among other things, the entry point of
the package and the name. That's how node knows which file to load
initially when requiring a "package" like node-sqlite3.

So for the case of node-sqlite3, you can see that the entry
point<https://github.com/developmentseed/node-sqlite3/blob/29cb28e543b6e30495c462c02d9168d7b8d2065a/package.json#L36>is
"lib/sqlite3.js". Now the fork that I made of node-sqlite3 that has
gyp
support, I used node-bindings
<https://github.com/TooTallNate/node-bindings>to require
the compiled node_sqlite3.node
file<https://github.com/TooTallNate/node-sqlite3/blob/gyp/lib/sqlite3.js#L1>.
node-bindings expects to find the compiled .node file in its default build
location, so once you have compiled with node-gyp, it will Just Work.

>From there, you can require() the node-sqlite3 directory and the package
handling logic will kick in. Hope that was helpful!

On Sun, Mar 4, 2012 at 11:53 AM, Lam <[email protected]> wrote:

> Well, I am reading the modules section on nodejs.org now....  Hope this
> will help me understand this build process.  Thanks.
>
>
> On Sunday, March 4, 2012 2:31:09 PM UTC-5, Lam wrote:
>>
>> Nathan,
>>
>> Just log a new issue per your request in github titled "Trouble using
>> node-gyp to build node-sqlite3 in Windows XP".  Hope this makes sense to
>> you.
>>
>> Thanks and I will give your suggestion a try now with the
>> node_sqlite3.node file.
>>
>> What puzzles me though is that in installing other modules in node such
>> as node-gyp, they always create a directory in the node_modules folder and
>> then there are plenty of other sub directories such as "lib", "bin" , etc
>> that has plenty of JS scripts.  So for the node-sqlite3, what should be the
>> proper directory structures and the files that need to go into them.
>>
>> I probably need to read up some materials about modules in node to learn
>> more about how to create modules.  So any link will be appreciated.
>>
>> Thanks.
>>
>> On Saturday, March 3, 2012 4:54:28 PM UTC-5, Nathan Rajlich wrote:
>>>
>>> Hey Jude, please open an Issue on the node-gyp issue tracker about the
>>> trouble you are having while building. I haven't seen that one yet. Include
>>> the Windows version you are using.
>>>
>>> Also, once you have the compiled bindings (which you have, in
>>> build/Release/node_sqlite3.**node), just try firing up node and
>>> require()ing the node-sqlite directory (if you are in the root of the
>>> module, do "require('./')" ). Hope that helps!
>>>
>>> mscdex, if you haven't already, I recommend checking out node-gyp. It
>>> makes all the steps in your node-win-dev example a lot simpler.
>>>
>>> On Sat, Mar 3, 2012 at 1:08 PM, C. Mundi <[email protected]> wrote:
>>>
>>>> I may have misspoken from memory.  As I sit here I do not recall the
>>>> command to build with gyp...too much going on...I apologize if I confused
>>>> things.  TooTallNate got it working in the first place.  If you're still
>>>> having trouble when I get back on Friday drip me a note and I will get out
>>>> my notes.
>>>>  On Mar 3, 2012 1:41 PM, "mscdex" <[email protected]> wrote:
>>>>
>>>>> On Mar 3, 2:38 pm, Jude Lam <[email protected]> wrote:
>>>>> > Thanks for the pointer on the vcbuild.bat.  Since i use the Windows
>>>>> msi
>>>>> > install file directly, it doesn't have all the source codes for node.
>>>>>
>>>>> This should be all you need: http://mscdex.net/upload/node-**
>>>>> win-dev.zip <http://mscdex.net/upload/node-win-dev.zip>
>>>>> Extract that, set NODE_ROOT to that path (not sure if it likes paths
>>>>> with spaces) and run vcbuild and you should be good to go IIRC.
>>>>>
>>>>> I haven't dealt with msbuild and/or gyp directly yet, so I can't
>>>>> really help you there. This vcbuild setup is just what ended up
>>>>> working for me with minimal pain/effort.
>>>>>
>>>>> --
>>>>> Job Board: http://jobs.nodejs.org/
>>>>> Posting guidelines: https://github.com/joyent/**
>>>>> node/wiki/Mailing-List-**Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nodejs" group.
>>>>> To post to this group, send email to [email protected]
>>>>> To unsubscribe from this group, send email to
>>>>> nodejs+unsubscribe@**googlegroups.com<nodejs%[email protected]>
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>>>
>>>>  --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-
>>>> **Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> nodejs+unsubscribe@**googlegroups.com<nodejs%[email protected]>
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>>
>>>
>>>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to