Project Setup: Part One
Explore the initial steps of setting up a Node.js project by creating a project directory and initializing it with a package.json file using npm. Understand the importance of semantic versioning and key fields in package.json to manage dependencies and project configuration effectively.
We’ll follow a series of tasks throughout the upcoming lessons as we work on our project.
Task 1: Setup our project folder
-
Navigate to the folder where we’ll store our new project.
-
Create a new directory called express-recipes (we could use any name that we like) and change in to it:
Task 2: Create a package.json file
- Turn our project into an npm package by running the following command:
Follow the instructions above to create a package.json file in the given terminal:
After executing the commands provided in the tasks above, we’ve created our first npm package.
The term “package” refers to a file or directory described by a package.json file. A package must contain a package.json file to be published to the npm registry.
What happens when we run the command above?
The command above loads a questionnaire containing a series ...