# web-1207 **Repository Path**: johnkuo/web-1207 ## Basic Information - **Project Name**: web-1207 - **Description**: git remote add origin git@gitee.com:johnkuo/web-1207.git git push -u origin "master" - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-12-07 - **Last Updated**: 2024-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## NPM > Node.js Package Manager => Node.js包管理器。 ### package.json 包的描述文件 1. 使用 `npm init` 或 `npm init -y` 生成 package.json 2. ``` { "name": "web-1207", "version": "1.0.0", "description": "> Node.js Package Manager => Node.js包管理器。", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" } dependencies devDependencies ``` ### node_modules 包|模块存放的文件夹 > npm install 可生成 node_modules文件夹 ### npm install 安装模块 ``` # 项目内安装|局部安装 npm install 简写 npm i npm install 简写 npm i npm install --save 简写 npm i -S npm install --save-dev 简写 npm i -D # 全局安装 npm install --global 简写 npm i -g npm install express # 将模块安装至package.json -> dependencies npm install express --save # 将模块安装至package.json -> dependencies npm install express --save-dev # 将模块安装至package.json -> devDependencies npm install npm --global # 将模块安装至全局 npm install --global express-generator # 将模块安装至全局 npm install # 安装项目的所有依赖(包括dependencies和devDependencies) # 读取package.json的所有依赖安装到node_modules文件夹 ``` ### npm uninstall 卸载包 ``` npm uninstall express # 卸载项目内的包 npm uninstall express -g # 卸载全局安装的包 ``` ### 查看安装的包 ``` npm ls # 查看全局安装的包 npm ls -g npm ls -g --depth 0 ```