Monday 1 October 2018

Exploring node package manager (npm)

Node Package Manager is used to perform below things.
a.   Install node.js packages
b.   Search online repositories available at (search.nodejs.org)

npm tool comes as part of node installation software. Open command prompt and execute the command npm.

C:\>npm

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    completion, config, create, ddp, dedupe, deprecate,
    dist-tag, docs, doctor, edit, explore, get, help,
    help-search, hook, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, profile, prune, publish, rb, rebuild, repo, restart,
    root, run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h     quick help on <command>
npm -l           display full usage info
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Users\Krishna\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.2.0 C:\Program Files\nodejs\node_modules\npm

Get the version of npm tool
Execute the command ‘npm version’ command.

C:\>npm version
{ npm: '6.2.0',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.9.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.22.0',
  v8: '6.8.275.24-node.14',
  zlib: '1.2.11' }

Get the help of a command
If you want to get help for any npm command, execute 'npm help <COMMAND_NAME>'


For example, ‘npm help install’ command opens help for install option in the browser.



Previous                                                 Next                                                 Home

No comments:

Post a Comment