These free mini-courses will give you a strong foundation in web development. Track your progress and access advanced courses on HTML/CSS, Ruby and JavaScript for free inside our student portal.
Scroll down...
NPM stands for Node Package Manager. Here is a quick video that explains NPM from the official NPM website.
NPM is Node.js's package manager, it handles the organization of all the reusable bundles of code that you will download, create and incorporate into your projects.
NPM ships with Node.js. It will be your interface for downloading, creating, updating, deleting and managing all of your Node.js packages. NPM even updates itself by name with $ npm install -g npm
.
When you want to create a new Node.js package you'll use NPM. When you want to download and update packages you'll use NPM. NPM can install global packages and local packages. The versions of these packages are tracked on a project specific basis via a package.json
file that closely resembles the function of a Gemfile
.
Basically the package.json
file is where NPM stores information about the current project. It will manage your packages to make sure compatible versions are installed.
Here is a quick rundown of using NPM:
# Install a package locally
$ npm install some-package
# Update local packages
$ npm update
# Install a package globally
$ npm install -g some-package
# Update a global package
$ npm update -g some-package
# Uninstall a package
$ npm uninstall -g some-package
# Create a new package or project
$ npm init
# ... then follow the instructions ...
NPM is incredibly useful and indispensable to Node.js. Working with Node.js will require you to be familiar with the ins and outs of NPM. Luckily they have very good documentation with clear examples.
Here is the full documentation for NPM.
Node.js has more packages than any other platform out there! Here are a few of the most popular ones:
Here is a link to the most starred NPM packages.
Node.js packages can be small helper libraries or full frameworks. Here are a few of the most popular Node.js frameworks.
There are countless frameworks out there for Node.js and new ones are always popping up. There are some definite big hitters out there that you most likely have already heard of. Here are a few:
Here is a link to even more popular Node.js frameworks.
If you've been around the Node.js or JavaScript community for a while you've probably heard of Meteor.js. You may not have heard of Express.js. Basically, Express.js is a small web framework that gives you the barebones tools to get a web application running. We'll be diving into how to create a small project with Express.js next.
Here are the important snippets of code from this lesson.
# Install a package locally
$ npm install some-package
# Update local packages
$ npm update
# Install a package globally
$ npm install -g some-package
# Update a global package
$ npm update -g some-package
# Uninstall a package
$ npm uninstall -g some-package
# Create a new package or project
$ npm init
# ... then follow the instructions ...
NPM will quickly become a tool that you use every day when working with Node.js. Now you're ready to create your own projects and packages using NPM. You're also officially able to take advantage of the wide range of useful open source code that the Node.js community has made available on the NPM registry. Share and enjoy!