npm cnpm node.js react vue.js installation

To sum up, or else he will have to check.
 
1. About: node.js and npm
  • js node.js is known as run-time, similar to java in the jvm.
  • npm is Node Package Manager, is node.js package management tools, such as we use react vue other form is required to install by npm.
  • cnpm Taobao npm (supports all commands except npm publish the https://npm.taobao.org/ ). Installation: npm install cnpm -g -registry = https : //registry.npm.taobao.org. You can view the version number by cnpm -v
  • Download the windows installation package node.js ( http://nodejs.cn/ ), connected directly npm are installed, the new version also.
First, install
1.$ sudo apt-get install nodejs
 
2.$ sudo apt-get install npm
 
Second, upgrade
    1. Upgrade npm command as follows:
$ Sudo install altitude above sea level -g
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
[email protected] /usr/local/lib/node_modules/npm
2. Upgrade node.js command as follows:
$ npm install –g n
$ N latest (node.js upgrade to the latest version) or $ n stable (node.js upgrade to the latest stable version)
    n can also follow later version number such as: $  n v0.10.26  or $  n 0.10.26
Three, npm Mirror Mirror replaced Taobao 
1. get a mirror image of the original address
$ npm get registry 
Set to Taobao
$ npm config set registry http://registry.npm.taobao.org/
2. replaced the original
$ npm config set registry https://registry.npmjs.org/ 
Fourth, the optional cnpm
1. Description: npm install because the plug-in is downloaded from the server abroad, by the impact of a large network, exceptions may occur if the server npm like in China, so we are happy to share Taobao team did this thing. ! From the official website: "This is a complete npmjs.org image, you can use this instead of the official version (read-only), synchronous frequency of the current 10 minutes to ensure the synchronization service as much as possible with the official.";
2. Official Website: http://npm.taobao.org ;
3. Install: command prompt npm install -g --registry CNPM = https://registry.npm.taobao.org ; Note: After installation is best viewed its version number cnpm -v or close the command prompt reopened , installing direct use there may be an error;
Note: cnpm fully consistent with npm usage, just npm changed when performing command cnpm (cnpm will be replaced by the following npm)

Fifth, global installation and local installation

  npm install the package into a local installation (local), global installation (global) are two, knock on the command line from the point of view, but there is no difference -g only,
   For example, we use the command npm install the popular Node.js web framework modules  express:
Npm install Express $ # local installation
Npm install Express $ - G # Global Installation
Sixth, uninstall
1. Uninstall npm
sudo uninstall altitude above sea level -g
2. Uninstall nodejs
sudo apt-get remove nodejs
 
2. In a vue react or project, usually given in README.md plug-in installation, commissioning, packing method.
In general :( domestic suggested cnpm, with who knows who)
  • npm install or cnpm install installation dependent project
  • npm run dev start the service (you can use the browser to view the project)
  • npm run build 打包 (eg: npm run build && node replace.js,最后的js做一些处理)(一般会发布到一个目录下,直接部署到web server就可以用了)
 
 
 
 
 
发布了202 篇原创文章 · 获赞 48 · 访问量 56万+

Guess you like

Origin blog.csdn.net/jo_say/article/details/104236177