Auto generate package.json file for Nodejs project


Nodejs project is the easiest and fastest way to create web applications. A package.Json file is the configuration file for the Nodejs project, it included all the information regarding the project. The dependencies, developer dependencies, starting scripts and so on. We can manually add a package file to our project. The structure of a minimal package file will be as follows.

{
  "name": "Project Name",
  "version": "1.0.0",
  "description": "Description of your Project",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Developer Name",
  "license": "ISC"
}

Auto generate package file

Node Package Manager can auto generate the package file by issuing the following command on Terminal

npm init
  •  npm will pull few question and answer them or leave it for default and then finally we will get the package.json file.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.