NPM

常用命令

Login to npm from a terminal

npm whoami 输出当前登录的用户名 npm login 登录,需要输入用户名、密码、邮箱。如果用户名不存在将会用该名称创建新的账号 npm profile get 获取用户信息 npm profile set <prop> <value> 设置用户信息

create a package.json

npm init [--yes|-y]

//config options for the init command
> npm set init.author.email "wombat@npmjs.com"
> npm set init.author.name "ag_dubs"
> npm set init.license "MIT"

packages

npm install 安装 npm-update 更新 npm-outdated 检查是否有更新 npm uninstall <package> [--save|--save-dev] uninstall local packages npm ls [[<@scope>/]<pkg> ...] aliases: list, la, ll list all the versions of packages that are installed, as well as their dependencies, in a tree-structure.

npm version <update_type> 更新包版本 npm publish 发布package

others

npm config set <key> <value> [-g|--global]
npm config get <key>
npm config delete <key>
npm config list [-l] [--json]
npm config edit
npm get <key>
npm set <key> <value> [-g|--global]

aliases: c

读取、设置npm默认配置

npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...]

aliases: s, se, find

搜索

npm view [<@scope>/]<name>[@<version>] [<field>[.<subfield>]...]

aliases: info, show, v

查看包信息

jungle