A huge snake enjoying the sun next to the pond in front of Akashi (明石) Station
Blind but deadly, calm but alert.

Setting up Node.js Package Manager (npm)

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

The commands shown here assume that Node.js and npm along with it have been installed.

Get all related versions on one command:

npm --versions

The output is JSON formatted and something similar to:

{ http_parser: '1.0',
  node: '0.10.26',
  v8: '',
  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 yourself if you intend to publish any packages. Currently only available via the main registry, which is registry.npmjs.org.

npm adduser

Check that it is your username with whoami command:

npm whoami

Set some of of the configuration values to match your common usage. More about different 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 "http://paazmaya.fi"
npm config set init.license "MIT"

Do you have a local registry or want to use the European npm mirror?

npm config set registry "http://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"