NodeJS By Examples
NodeJS Installation on Debian 7.7 - Compiling NodeJS from the latest source
Compiling NodeJS from the source
0. Check Node distribution: http://nodejs.org/dist/
1. # cd /usr/src
2. Grab the latest: # wget http://nodejs.org/dist/node-latest.tar.gz
3. Untar: # tar tar zxf node-latest.tar.gz
4. # cd node-v0.12.00
5. # ./configure
6. # make
7. # make install
8. # /usr/local/bin/node -v or just #node -v
v0.12.0
9. # npm -v
2.5.1
10. #npm list -g
└── (empty)
SYMBOLIC LINKS
We don't have to create symbolic links to /usr/bin/ directory beacuse commands #node and #npm works without symbolic linking.
ENVIRONMENT VARIABLE
Set NODE_PATH environment variable. Otherwise NodeJS Apps will not be able to load global modules!
#export NODE_PATH=/usr/local/include/node:/usr/local/lib/node_modules
INSTALLATION DIRECTORY PATHS
NodeJS is installed into:
/usr/local/include/node/ - node API javascript library
/usr/local/bin/node - node executable binary file
NPM is installed into:
/usr/local/lib/node_modules/ - node modules
/usr/local/bin/npm -npm binary file
Now when we install module globally it will go into /usr/local/lib/node_modules/ for example # npm install -g express .