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:
This process may be slow, waiting to be completed, and then installed:
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:
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:
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.