Previous: , Up: Creating a packagejson File   [Index]


3.2.1.2 Creating a new package.json File

You can create a package.json file by running a CLI questionnaire or creating a default package.json file.

CLI Questionnaire

To create a package.json file with values that you supply, use the npm init command. Run the following command from the root directory of your package and answer the questions.

npm init
Default package.json File

To create a default package.json using information extracted from the current directory, use the npm init command with the ‘--yes’ or ‘-y’ flag.

npm init --yes