npm

npm

install

  • mostly install it with nodejs
  • brew
  • zip

update

1
npm install -g npm

package

1
2
3
4
5
6
7
// install package
npm install ${package_name}
npm uninstall ${package_name}
// -g is global
// --save-dev is install in dev dependency
npm list [-g] [--depth 0]

update

  • default native

    1
    npm update [-g] [${pacakge_name}]
  • npm-check

    1
    2
    3
    npm-check
    // use gui to update
    npm-check -u
  • npm-check-updates

    1
    ncu
    • Red = major upgrade (and all major version zero)
    • Cyan = minor upgrade
    • Green = patch upgrade

remove useless packages

1
npm prune [${pacakge_name}]