Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created April 19, 2016 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/2a8e9a2795463e4b7a44cb752e53b375 to your computer and use it in GitHub Desktop.
Save tmcw/2a8e9a2795463e4b7a44cb752e53b375 to your computer and use it in GitHub Desktop.
npm is a package manager. it's a website that keeps a big catalog of software
that can be installed by anyone.
some of that software you use directly, but other software you use as parts.
software you use directly:
"bin"
software you use as a dependency:
"main"
--------------------------------------------------------------------------------
npm works really well with GitHub, but isn't dependent on GitHub. when you
publish a module to npm
$ npm publish
you upload a copy of that software to npmjs.org. When people install your module
with npm
$ npm install that-module
they are downloading it from npmjs.org
--------------------------------------------------------------------------------
To install software with npm, you use the `install` method. This both downloads
and installs the software. There are two ways to install software - one which
makes it easy to include as a part of your application, and another that
lets you use the software directly:
You install software as part of your application like
$ npm install chalk --save
chalk is a module you use by including it in your program: it helps your program
color text.
And you install software to use yourself like
$ npm install cli-weather -g
cli-weather shows you the weather: after you install it, you get a new command
line command called `weather` that tells you the weather.
--------------------------------------------------------------------------------
Let's install the weather
$ npm install cli-weather -g
Now run
$ weather -a "Bangalore"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment