npm init

Share this video with your friends

Social Share Links

Send Tweet
Published 10 years ago
Updated 5 years ago

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

Instructor: [00:00] 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.

[00:13] It asks for the name. It's going to use the directory name by default.

[00:16] It asks for a version. We usually start that off at zero.

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

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

[00:32] A test command to use for running unit tests.

[00:36] 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.

[00:47] You can provide keywords to indicate the sorts of things that your package does.

[00:52] 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.

[01:01] 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.

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

[01:23] There we go. We've got a basic starting point package JSON file to manage our dependencies.

egghead
egghead
~ 14 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today