paazmaya.fi

The Website of Juga Paazmaya | Stories about web development, hardware prototyping, and education

Setting up Node.js Package Manager (npm)

Node.js packages, plugins and extensions are handled via npm. This page shows how to configure your npm client

Anyone creating their own packages that are to be published in a npm repository, might find these instructions handy.

Retrieve all related versions with one command:

npm --versions

The output is presented in JSON format, similar to:

{ http_parser: '1.0',
  node: '0.10.26',
  v8: '3.14.5.9',
  ares: '1.9.0-DEV',
  uv: '0.10.25',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1e',
  npm: '1.4.3' }

Login or register if you plan to publish packages. Currently, this is only possible through the main registry at registry.npmjs.org.

npm adduser

Confirm your username with the whoami command:

npm whoami

Adjust some configuration values to suit your preferences. Learn more about various configuration options.

npm config set init.author.name "Juga Paazmaya"
npm config set init.author.email "olavic@gmail.com"
npm config set init.author.url "https://paazmaya.fi"
npm config set init.license "MIT"

Interested in a local registry or using the European npm mirror?

npm config set registry "https://registry.npmjs.eu/"

Locally replicating the whole registry might make sense in case it is heavily used for reading, but the size is around 180 GB at the time of writing.

All the above settings write to ~/.npmrc

Release a patch level (+0.0.1) version, in the Git repository of the given project with the version command:

npm version patch -m "Time has come to put out %s, as it contains many things"