HTML and CSS Reference
In-Depth Information
Figure 23-6.
Here, you can see that you have created a new directory, navigated into it via the cd command,
and printed the working directory to make sure that you are in the right place
Introduction to npm
Now that I have covered installing
Node.js
and how to use the command line, you are ready to look at npm, which is
at the core of Node. npm allows you to add new features and functionality to your vanilla installation of
Node.js
. On
its own, Node doesn't do much outside of allowing you to run it via the command line. There are literally hundreds of
packages that you can download from
http://npmjs.org
that can be added to Node to make it more powerful. It is
really easy to install new packages. You simply use the following command:
> npm install PACKAGE_NAME
Over the rest of this chapter, I will discuss different types of packages that you will need to install to create
more powerful build scripts. The biggest advantage that npm affords is its ability to help you manage your package
dependencies. By tracking which packages you install in your project, it becomes easier to share this list with other
team memebers or reinstall a specific version when setting up a project from scratch. To do this, you will have to
create a package JavaScript Object Notation (JSON) file for your own project. At this point, you should be inside the
new folder that you created in the previous section. Run the following command to activate npm's project setup
wizard:
> npm init
You should see the screen displayed in Figure
23-7
.