Using npm to install or update required packages just like bundler for rubygems

As of npm 1.0 (which is now what you get by default if you follow the steps in the README file), “bundle” is no longer a segregated thing — it’s just “how it works”.

So:

  1. Put a package.json file in the root of your project
  2. List your deps in that file

    { "name" : "my-project"
    , "version" : "1.0.0"
    , "dependencies" : { "express" : "1.0.0" } }
    
  3. npm install Since you’re calling this with no args, and not in global mode, it’ll just install all your deps locally.

  4. require("express") and be happy.

Leave a Comment

tech