Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    npm init


    npm init provides an interactive step-by-step interface for creating a package.json



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: When you're going to work with nodejs or Browserify, the =easiest way to get started and prime your working directory is to use the npm init command. If we type "npm init," we're going to get a series of questions here.

    It asks for the name. It's going to use the directory name by default.

    It asks for a version. We usually start that off at zero.

    Description. You can provide a description of your module here. I usually leave it blank when I'm getting started.

    The entry point -- what will be the main file used for this module once it's done.

    A test command to use for running unit tests.

    Git repository. If I had set this up with a Git url already, it would prepopulate that and know where my Git repository is located.

    You can provide keywords to indicate the sorts of things that your package does.

    License ISC is basically a simplified version of MIT. If you want to change that to MIT or Apache or something, you can type in there.

    Then you get a preview of what this file is going to look like. You can say yes, this is OK. It is going to then generate the package JSON that you have just instructed it to use.

    You can see here that my author information is prepopulated because of some configuration settings I have in my environment.

    There we go. We've got a basic starting point package JSON file to manage our dependencies.