1 NPM Command
1.1 Init Project
npm init -y
initializes a new Node.js project by creating a package.json file with default values. Let me break this down:
npm
is the Node Package Manager that comes with Node.js installationinit
is the command to create a new package.json file-y
is a flag that automatically answers “yes” to all the prompts that would normally ask for project information
Without the -y
flag, npm would interactively ask you questions about:
- Project name
- Version
- Description
- Entry point
- Test command
- Git repository
- Keywords
- Author
- License
The -y
flag skips these questions and creates a package.json with default values based on your current directory name and other automatically determined information.