npm init -y

Godson PrakasiaGodson Prakasia
1 min read

npm init -y is a quick way to generate a package.json file in your project directory without having to answer all the questions manually.

📦 What it does:

When you run:

npm init -y

It creates a default package.json file that looks like this:

{
  "name": "your-project-folder-name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

You can then install packages like Vite, React, Vue, etc., and configure your scripts later.


✅ When to use it:

• When you’re starting a new Node.js or frontend project.

• When you want to install dev tools (like Vite) in an existing folder that’s not initialized yet.


0
Subscribe to my newsletter

Read articles from Godson Prakasia directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Godson Prakasia
Godson Prakasia