npm — node package manager
全局安装nodejs包
npm -g install net-ping
查看已经安装的nodejs应用
npm ls -g installed
创建项目过程,首先创建一个目录 mvc-express ,进入后输入
npm init
回答一些问题创建项目
This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sane defaults. See `npm help json` for definitive documentation on these fields and exactly what they do. Use `npm install--save` afterwards to install a package and save it as a dependency in the package.json file. Press ^C at any time to quit. name: (mvc-express) version: (0.0.0) 0.0.1 description: my try of express entry point: (app.js) test command: npm test git repository: keywords: author: jpuyy license: (ISC) About to write to /private/var/forge/node/mvc-express/package.json: { "name": "mvc-express", "version": "0.0.1", "description": "my try of express", "main": "app.js", "scripts": { "test": "npm test" }, "author": "jpuyy", "license": "ISC" } Is this ok? (yes) yes
接下来我要安装一些包时,使用 npm install
npm install express --save
清理缓存
npm cache clean
检查
npm audit fix
Leave a Reply