Create Node.js project using Node Package Manager

After successfully installing Node.js, you can use the Node Package Manager (NPM) tool to create a new Node.js project to start working on it. How is it in details? In this tutorial, I will guide you all to do this.

First, open Terminal (macOS or Linux) or Console (Window), go to a directory where you want to create the project, then enter the following command:

Myself as follows:

Create Node.js project using Node Package Manager

Here, to create a Node.js project, we need to fill in some information about our project. First, as you can see, is the package name information. This is the name of the project you want to create. The value “(javascript)” is the default value. You can leave it as default or fill it with your needs. Then hit Enter, myself as follows:

Create Node.js project using Node Package Manager

Next, as you can see, is the version information. I’ll leave it to default and hit Enter to continue:

Create Node.js project using Node Package Manager

Add some description of your project. You can add your own and then press Enter to continue, as follows:

Create Node.js project using Node Package Manager

The entry point is the file that contains the main script for our project. You can leave the defaults, we can edit them later, and then press Enter.

Create Node.js project using Node Package Manager

If you already know the command to run the test in Node.js then you can declare it here. I have no need so will leave this information empty then press Enter.

Create Node.js project using Node Package Manager

If you have a need to use Git to manage source code, then you can enter information about Git Repository here. I will leave this information empty, then press Enter.

Create Node.js project using Node Package Manager

keywords are some information that you can fill in so that users can search your project. I have no need, so will leave this information empty, then press Enter to continue.

Create Node.js project using Node Package Manager

Author is the author’s information. Please enter your name: D, then press continue.

Create Node.js project using Node Package Manager

License relates to the copyright of the project. You can enter the license information according to your needs or use common licenses such as BSD-3-Clause, MIT, ISC, … Here, I will default and then Enter.

Create Node.js project using Node Package Manager

This is the window to confirm the information that you just entered. If OK then press Enter to finish creating the new Node.js project using Node Package Manager.

Check the current directory, you will see a file named package.json containing the information about the Node.js project that we just entered. My result is as follows:

Add Comment