How can I install this node.js binary/module?
I'd like to use this xml parser but there's absolutely no information on how to install it. It doesn't seem available on npm
, and I haven't come across any good instructions through google.
I'm on Debian 5 Lenny, and relatively new to node.js. Someone mentioned to append the NODE_PATH
environment variable, but I'm not sure how I should structure it, in terms of choosing WHERE 开发者_开发问答to store my node binaries.
Can someone provide a full example demonstration of setting it up? Including git clone
ing if necessary.
PS - I'd like multiple users to use these modules so I don't just want to put this in ~
for myself.
OK, what you need to do is the following
- Open
/etc/bash.bashrc
- Add the line
export NODE_PATH="/usr/local/lib/node"
to the end of the file
Note: If you edit the file with a graphical program always use gksudo
instead of sudo
otherwise you may end up with files that are not root's being owned by root
Now Node will search for modules in /usr/local/lib/node
(create it if it doesn't exist, also you need to start a new bash since bashrc is only read on start), next step is to put the stuff there.
- Get the repo, either by downloading it or cloning it
- Copy the
o3-fastxml
folder fromnode-o3-fastxml/lib
into/usr/local/lib/node
, so that you have a/usr/local/lib/node/o3-fastxml
folder - Make sure the files are owned by root but can be read by everyone else
Last step, require the module in Node and check whether everything is working:
require('o3-fastxml') //magic! Gnah, Node will find the folder o3-fastxml on the path and will then find the index.js inside the folder
That should be all that's needed, if I'm not mistaken :)
Just leave a comment if it doesn't work.
精彩评论