HTML and CSS Reference
In-Depth Information
Here, you are just testing that Node Package Manager (npm) is working and correctly installed. If you don't see
instructions to run npm, you may need to restart your computer or try reinstalling Node.
Command-Line Primer
I could have brought this up at the beginning, but I didn't want to scare you off. If you haven't noticed by now, you
will be using the command line a lot for running your build script. Some people are terribly afraid of the command
line, so I thought I would just cover the basics here. The first thing to keep in mind is that nothing bad will happen,
so long as you take your time and are careful about what you enter at the prompt. The command line is an incredibly
powerful tool, and, as a Web developer, you should become very familiar with it, especially as you go deeper into code
automation and working with servers. For reference, Table 23-1 contains a few of the most common Bash commands
that you will be using plus descriptions of how they work:
Table 23-1. Common Bash Commands and Examples
Action
Command
Description
> pwd
Print working directory
This will show you your current path on the file system.
> ls
List contents of directory
This will let you see everything inside the current
directory you are in.
> cd /path/to/new/folder
Change directory
This will let you navigate into a new folder.
> cd ../
Go back
This navigates back one directory.
> mkdir FOLDER_NAME
Make new folder
This allows you to make new folders on the file system.
> rm FILE_TO_DELETE
Delete
This allows you to delete and file a folder on the system.
> rm -rf FOLDER_TO_DELETE
Delete all files
If you are trying to delete a directory with multiple files
and folders inside it, you will need to force it to perform
the delete recursively.
> clear
Clear console
This command will clear the console window.
Ctrl+C
Stop running command
Some commands that you run will require input or will
continuously run and need to be stopped manually.
There are lots of great resources on the Web that cover how the command line works. It's important to note that
these are Bash commands, so if you are not using Git Bash on Windows, and instead favor the default command line,
some of these will be different.
To get your feet wet, let's create a new folder for your test project. In the command line, you will use the following
commands to create a new directory, move into it, and then make sure that you are in the right place:
> mkdir NodeSampleProject
> cd NodeSampleProject
> pwd
You can see these commands being run in Figure 23-6 .
 
Search WWH ::




Custom Search