介绍
NPM is the package manager for JavaScript and the world’s largest software registry. Discover packages of reusable code — and assemble them in powerful new ways.
npm is installed with Node.js(npm作为node的一个模块)
安装
1 | |
update
1 | |
使用
初始化项目,会自动创建package.json。
1 | |
添加模块
1 | |
本地安装在项目下node_modules目录,全局安装到/usr/lib/node_modules/或~/.npm/。
如果dependencies中已经添加好了模块,则直接安装即可。
1 | |
添加脚本
1 | |
运行
1 | |
相关书籍
《The Node Beginner Book》
《The Node Craftsman Book》