Recently installed Nodejs on the development machine. Originally very simple thing, the result has encountered some problems, in order to facilitate the later review, or to take some important steps and encountered problems recorded, for everyone to reference. (After all, good memory is worse than bad writing:)).
Installing Nodejs
It would have been easy to install this because it had been installed before and it went well. But this time there was an accident:
First download the installation package from Nodejs official website, I was downloading this version: Http://nodejs.org/dist/v0.10.26/node-v0.10.24.tar.gz.
Download the installation package
wget http://nodejs.org/dist/v0.10.26/node-v0.10.24.tar.gz
Extract
Tar jxvf node-v0.10.24.tar.gz
./configure
The result is an error ...
./configure
File "./configure", line 442
FPU = ' Vfpv3 ' if armv7 Else ' Vfpv2 '
^
Syntaxerror:invalid syntax
This head big, only ask G elder sister, after some search, finally still found the problem solution. See: http://stackoverflow.com/questions/14989164/node-js-configure-file-syntax-error-line-433. In fact, the version of Python is too low, my system is 2.4.3, see the post with the python2.7 solved the problem, so according to gourd painting scoop, upgrade Python.
1. Download python2.7.5
wget http://legacy.python.org/ftp//python/2.7.5/Python-2.7.5.tar.bz2
2. Extracting files
Tar xvf python-2.7.5.tar.bz2
3. Create the installation directory
Mkdir/usr/local/python27
4. Install Python
CD Python-2.7.5
./configure--prefix=/usr/local/python27
Make
Make install
5. Modify the old version of ln direction (note: This change may affect the use of Yum)
Rm-f/usr/bin/python
mv/usr/bin/python/usr/bin/python2.4.3
Ln-s/usr/local/python27/bin/python/usr/bin/python
Vi/usr/bin/yum (Change the original/usr/bin/python to/usr/bin/python2.4)
Yum is written in Python and will cause Yum to be unavailable after upgrading a new version of Python, as in the error message when running Yum:
There was a problem importing one of the Python modules
Required to run Yum. The error leading to this problem was:
No module named Yum
Workaround:
Find a Yum file and edit this py file
[email protected] ~]# which Yum
/usr/bin/yum
[Email protected] ~]# Vi/usr/bin/yum
Change #!/usr/bin/python to: Whereis python results (old version of Python)
#!/usr/bin/python2.4
Then save OK.
Take a look at the current Python version:
[[email protected] node-v0.10.24]# make install
Make-c out Buildtype=release v=1
MAKE[1]: Entering directory '/usr/src/node-v0.10.24/out '
Ld_library_path=/usr/src/node-v0.10.24/out/release/lib.host:/usr/src/node-v0.10.24/out/release/lib.target: $LD _ Library_path; Export Ld_library_path; Cd.. /deps/v8/tools/gyp; Mkdir-p/usr/src/node-v0.10.24/out/release/obj/gen; Python.. /.. /tools/js2c.py "/usr/src/node-v0.10.24/out/release/obj/gen/libraries.cc" CORE off. /.. /src/runtime.js. /.. /src/v8natives.js. /.. /src/array.js. /.. /src/string.js. /.. /src/uri.js. /.. /src/math.js. /.. /src/messages.js. /.. /src/apinatives.js. /.. /src/debug-debugger.js. /.. /src/mirror-debugger.js. /.. /src/liveedit-debugger.js. /.. /src/date.js. /.. /src/json.js. /.. /src/regexp.js. /.. /src/macros.py
Traceback (most recent):
File ".. /.. /tools/js2c.py ", line $, in <module>
Import bz2
Importerror:no module named bz2
MAKE[1]: * * * [/usr/src/node-v0.10.24/out/release/obj/gen/libraries.cc] Error 1
MAKE[1]: Leaving directory '/usr/src/node-v0.10.24/out '
Make: * * * [node] Error 2
4. Compile and install Nodejs
Tar zxvf node-v0.10.0.tar.gz
CD node-v0.10.0
./configure
Make
Report an error when make:
Import bz2 importerror:no module named BZ2 error, which indicates a lack of bz2
Installing BZ2
Yum-y Install bzip2*
Go to the Python directory, then compile the Python once, and then install Nodejs
And then execute
CD node-v0.10.0
./configure
Make
Make install
Yum Install-y bzip2*
CD python-2.7. 2/modules/zlib
./configure
Make && make install
CD python-2.7. 2/
Python2. 7 setup.py Install
Python--version
Python 2.7.5
Now that the Python upgrade installation is complete, proceed to install Nodejs.
Proceed to the Nodejs directory and execute the./configure command. No more error, then Make,make install. A green light, smooth installation completed.
Test it and write hello.js with the content console.log (' Hello Nodejs ').
Node-v
v0.10.24
Node Hello.js
Hello Nodejs
Well, Nodejs also installed successfully.
Install Nodejs under Linux