Uninstall installation Node.js and NPM process detailed _node.js

Source: Internet
Author: User
Tags php framework install node

The following is a note of the steps to install CentOS in the local WINDWOS environment with vagrant virtual machines (Homestaead) and production environments Aliyun Node.js systems, and the differences between NPM installation dependencies.

Install Node.js using source code compilation. First uninstall the Node.js on the machine, and I'll just post the steps provided on the Stack Overflow:

1. Uninstall NPM and Node.js

Uninstall NPM First, the command is: sudo npm uninstall npm -g , and then uninstall Node.js.

Running which node would return something like/path/bin/node.

Then Run Cd/path

This are all are added by Node.js.

Rm-r bin/node Bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc

If the Ubuntu system is installed using Apt-get, you can use the command:

sudo apt-get remove Nodejs

2. Download, compile, install Node.js

Node.js Official download page: https://nodejs.org/en/download/current/

I choose the latest version, download the address is: https://nodejs.org/dist/v6.3.1/node-v6.3.1.tar.gz

General third party software on Linux installation directory is/usr/local, using the wget download source (address their own attention to replace):

sudo wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz

Decompression:

Tar xzvf node-v* && CD node-v*

Compile:

./configure Make

This process may be slow, waiting to be completed, and then installed:

sudo make install

If all goes well, Node.js is installed and use Node-v to view the version.

vagrant@homestead:/usr/local$ node-v
v6.3.1

3. Installing NPM Dependencies

There are different virtual machines on Windows and real Linux systems, directly on Linux:

NPM Install

Windows virtual machine commands need to add parameters, or you will be able to error:

NPM Install--no-bin-links

4. Install Taobao NPM image acceleration

In fact, the third step before you can install the NPM image Taobao, using the command:

NPM install-g cnpm--registry=https://registry.npm.taobao.org

This allows most NPM commands to be replaced with CNPM, such as:

CNPM Install

Since I use the Laravel PHP framework, I need to use the Gulp front-end build tools, so to install gulp, use the Taobao NPM mirrored installation:

CNPM Install--global Gulp

To this node.js and NPM dependencies are installed successfully, everything as new.

There is also a way, do not install CNPM only Taobao mirror, set NPM mirroring:

NPM Config Set Registry https://registry.npm.taobao.org

Summarize

The above is uninstall installation Node.js and NPM process all content, hope this article content can be helpful to everybody, if have the question welcome everybody to comment the discussion.

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.