Install Node. js in Linux

Source: Internet
Author: User

Install Node. js in Linux

Nodejs has been installed in Linux recently. This was a very simple thing, And I encountered some problems. To facilitate future reference, I recorded some important steps and problems for your reference. (After all, is it better to have a good memory :)).

Install Nodejs

I thought it was easy to install this because it was installed before and it was very smooth. But this time there was an accident:

First, download the installation package from the official node. js website. I downloaded 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

An error is returned...

./Configure

File "./configure", line 442

Fpu = 'vfpv3' if armv7 else 'vfpv2'

^

SyntaxError: invalid syntax

This is big. I only consulted G Jie. After some searches, I finally found a solution to the problem. See: http://stackoverflow.com/questions/14989164/node-js-configure-file-syntax-error-line-433. In fact, the python version is too low. In my system, it is 2.4.3. I read the post using python2.7 to solve this problem, so I upgraded python by using the gourd image.

1. Download python2.7.5

Wget http://legacy.python.org/ftp//python/2.7.5/Python-2.7.5.tar.bz2

2. decompress the file

Tar xvf Python-2.7.5.tar.bz2

3. Create an 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 to point to (Note: After modification, yum usage may be affected)

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. Upgrading the new version of python will cause yum to become unavailable. The following is an 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

Solution:

Find the yum file and edit the py file.

[Root @ TC-Boss ~] # Which yum

/Usr/bin/yum

[Root @ TC-Boss ~] # Vi/usr/bin/yum

#! /Usr/bin/python changed to: Result of whereis python (earlier version of python)

#! /Usr/bin/python2.4

Then save OK.

Check the current python version:

Python -- version

Python 2.7.5

Now, the python upgrade and installation are complete, and the Nodejs installation continues.

Decompress the directory of nodejs, and then execute the./configure command. If no error occurs, make and make install. The installation is successful with a green light.

Test it and write hello. js with the content of console. log ('Hello nodejs ').

Node-v

V0.10.24

Node hello. js

Hello Nodejs

Now, nodejs has been installed successfully.

Install and configure the Node. js development environment in javasru 12.04

Getting started with Node. Js [PDF + related Code]

Node. js getting started Development Guide

Install and configure Node. js

Compile and install Node. js in Ubuntu

Node. js details: click here
Node. js: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.