How to install this node.js binary / module?

I would like to use this xml parser , but there is no information on how to install it. This is not like npm, and I did not find any good instructions through Google.

I am on Debian 5 Lenny and relatively new to node.js. Someone said to add an environment variable NODE_PATH, but I'm not sure how to structure it in terms of choosing WHERE for storing node binaries.

Can someone provide a complete example of demonstrating its configuration? Including git cloneing as needed.

PS - I would like several users to use these modules, so I just do not want to put this in ~for myself.

+3
source share
1 answer

Ok you need to do the following

  • Open /etc/bash.bashrc
  • Add a line export NODE_PATH="/usr/local/lib/node"to the end of the file

Note. . If you are editing a file with a graphical program, always use gksudoinstead sudo, otherwise you may get files that do not belong to root, root

Now Node will look for modules in /usr/local/lib/node(create it if it does not exist, you also need to start a new bash, since bashrc is read only at startup), the next step is to put it there.

  • Get a repo by either downloading it or cloning it
  • Copy the folder o3-fastxmlfrom node-o3-fastxml/libto /usr/local/lib/nodeso that you have a folder/usr/local/lib/node/o3-fastxml
  • Make sure the files are owned by root, but can be read by everyone else.

, Node , :

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

, , :)

, .

+6

Source: https://habr.com/ru/post/1777503/


All Articles