A. Nodejs installation
1. Download Nodejs source code, this is currently the latest version
Http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
First ensure that the system is installed to python,gcc,g++, if not installed:
$ sudo apt-get install python
$ sudo apt-get install build-essential
$ sudo apt-get install gcc
$ sudo apt-get install g++
2. Unpack the installation package
TAR-ZXF node-v0.10.24.tar.gz
CD node-v0.10.22/
3. Compile and install
/configure–prefix=/opt/nodejs #这里可以不指定目录, direct execution./configure commands are also available.
Make #这里有些慢, need to wait patiently
Make install
4, test installation
Enter node--version test was installed successfully, if the display version number indicates successful installation, the following node-related parameters
anwj@anwj:~/nodejs$ node--help
Usage:node [Options] [e-script | script.js] [arguments]
Node debug script.js [arguments]
Options:
-V,--version print node ' s version
-E,--eval script evaluate script
-P,--print evaluate script and print result
-I,--interactive always enter the REPL even if stdin
Does not appear to be a terminal
--no-deprecation Silence deprecation warnings
--trace-deprecation show stack traces on deprecations
--v8-options Print V8 command line options
--max-stack-size=val set max V8 stack size (bytes)
Two, NPM (Node Package manager)
You only need to execute the following command:
1.curl http://npmjs.org/install.sh | Sh
If there is a permission problem during the installation, you need to execute the above statement under root, or use sudo.
Curl Http://npmjs.org/install.sh | sudo sh
2 other installation methods, such as obtaining the newest branch of npm from Git, refer to the instructions on the http://npmjs.org/doc/README.html.