Ubuntu Installation Nodejs

Source: Internet
Author: User

0 problems arise:

Use Hexo to build a static blog, so you need to use NPM, install Nodejs

Use sudo apt-get install Nodejs installed in Ubuntu directly Nodejs thought it would be fine.

It can then be downloaded via NPM install-g Hexo, but the Hexo command fails for the reason see

Build a personal blog with GitHub + Hexo (v)-Ubuntu Upgrade Hexo command expires

1 Cause Analysis & Resolution

It is estimated that you simply use sudo apt-get install Nodejs so that node is not good because it is installed

Node-v's not responding.

Nodejs-v v0.10.33

= Are these two goods the same?

Why solve the problem after node-v v0.10.35

So what is the Nodejs installed through the previous instructions?

As for the solution

Official website download, own configuration, for the general open source package has binary distribution and source code distribution

source code version, you need to compile yourself into an executable file binary executable can be used to directly use the compiled version

Download the binary compiled version and unzip to the folder test.

Enter Test/bin: There is node NPM inside

./node-v./npm-v can see the relevant version number

Because the/home/kun/mysofltware/node-v0.10.26-linux-x64/bin directory is not in the environment variable, it can only be used to program node in this directory. If the node command is executed under another directory, it must be accessed through an absolute path.

If you want to be accessible in any directory, you will need to add the directory where node is located, either by adding the PATH environment variable, or by linking node and NPM to the default path directory of the system via a soft connection,

Soft connection mode

The Echo $PATH in the terminal can get the contents of the path variable, and the system default Path environment variable includes/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:, The colon is a separator character. So we can link node and NPM to the/usr/local/bin directory below to execute

12 ln -s /home/kun/mysofltware/node-v0.10.26-linux-x64/bin/node /usr/local/bin/nodeln -s /home/kun/mysofltware/node-v0.10.26-linux-x64/bin/npm /usr/local/bin/npm

With this, you can access node, and node deployment is complete.

environment variable configuration.

In the node directory, perform the PWD to get the directory where node is located, to add this directory to the PATH environment variable

See blog:

Deploy Nodejs under Linux (two ways)

This configuration is complete and can be accessed in any other directory NODE/NPM

At this point, Hexo works.

2 knowledge points/legacy issues

What version of Nodejs is the sudo apt-get install Nodejs?

Su switch to the root authentication failed password reset solution? sudo passwd

If it is to download the source package, how to compile?

How to configure environment variables?

Soft connection mode?

...

Ubuntu Installation Nodejs

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.