在工程本地安装依赖包
npm install [email protected]
系统全局安装依赖包
npm install --global [email protected]
npm install -g [email protected]
如果不指定版本,默认安装最新版本。
查看本地依赖包
npm ls
使用package.json管理依赖包
npm install
package.json文件中依赖版本号的管理
~version “Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.
使用n管理node和npm
n stable