1. npm install moduleNames:安装Node模块

  2. npm install moduleNames –save:安装Node模块并添加依赖(写入到package.json)会在当前目录下安装包,版本信息也会添加到依赖中,会安装到dependencies选项中

  3. npm install moduleNames –save-dev 开发阶段使用的依赖包,会安装到devDependencies选项中

  4. npm install moduleNames -g 全局安装

  5. npm list:查看当前目录下已安装的node包

  6. npm list moduleNames: 查看模块版本

  7. npm update moduleName:更新node模块

  8. npm uninstall moudleName:卸载node模块

  9. npm init: 初始化

  10. npm ls: 查看所有模块

  11. 初始化工程后会生成package.json

{
  "name": "npm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",//入口文件
  "dependencies": { //项目依赖包
    "_jquery@3.2.1@jquery": "^3.2.1",
    "jquery": "^3.2.1"
  },
  "devDependencies": {},//开发阶段依赖的包
  "scripts": { //命令
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}