Basics
Challenges
Classes
Debugging
Events
External Files
Flow Control
Forms
Functions
Html Elements
Installation
Interfaces
Keywords
Modules
Namespaces
Operators
Reference Files
String
Types
All npm packages contain a file, usually in the project root, called package.json
- this file holds various metadata
relevant to the project. This file is used to give information to npm that allows it to identify the project as well as
handle the project's dependencies.
It can also contain other metadata such as a project description, the version of the
project in a particular distribution, license information, even configuration data - all of which can be vital to both
npm and to the end users of the package. The package.json
file is normally located at the root directory of a Node.js
project.
In this example, I have set up my package.json
file to run an npm script labeled as "start".
Node.js will watch and listen for the command "start" in this app and run the http-server
script.
Examples:
Then in order to run this package, I simply navigate to the working folder from a command prompt and type
npm {command name}
like so: