npm – save installed packages as dependencies

Update January 2016

npm now supports this out of the box. I have npm version 3.5.2.

so with just a node_modules folder with underscore installed.

npm init --yes

then:

cat package.json

Contained within package.json:

"dependencies": {
    "underscore": "^1.8.3"
  },

Leave a Comment