Vizio

NPM Dependencies Gotcha

| Comments

For the last year I’ve been working with nodejs to create web applications and more often to create dev tools for everyday use.

NodeJS comes with a pretty simple but really powerful and elegant package manager called NPM. NPM is pretty straight forward to use but now we are facing some slight problems with managing dependencies.

So this is an attempt to explain how NPM dependencies work.

Let’s start with an example:

Context

You are developing a nodejs application which you wish to distribute as an NPM package. This application uses the coffee-script module which is listed in the “dependencies” section of the package.json file as well as another module called “secondNPM”. “secondNPM” uses coffee-script as well so it will be listed in its package.json file.