5.1 What is a third-party modules
别人写好的,具有特定功能的,我们能直接使用的模块即第三方模块,由于第三方模块通常都是由多个文件组成并且被放置在一个文件夹中,所以又名包。
Third-party modules exist in two forms
- In the form of js files, provide specific functions to achieve the project's API interface
- A command-line tool form, project development aid
5.2 acquiring third-party modules
npmjs.com 第三方模块的存储和分发仓库
npm(node package manager): node 的第三方模块管理工具
- Download: npm install the module name
- Uninstall: npm uninstall package module name
5.3 Global installation and local installation
- Command-line tool: global installation
- Library file: local installation
5.4 third-party modules nodemon
nodemon是一个命令行工具,用以辅助项目开发
在Node.js中,每次修改文件都要在命令行工具中重新执行该文件,非常繁琐
Steps for usage
1.使用npm install nodemon -g 下载它
2.在命令行工具中用nodemon 命令替代node 命令执行文件
5.5 third-party modules nrm
nrm(node registry manager): npm 下载地址切换工具
npm 默认的下载地址是国外,国内下载速度慢
Steps for usage
1.使用npm install nrm -g 下载它
2.查询可用下载地址列表 nrm ls
3.切换npm 下载地址 nrm use 下载地址名称