npm-init
creates a new package
TLDR
Initialize new project
$ npm init
Initialize with defaults$ npm init -y
Create with initializer$ npm init [initializer]
Create React app$ npm init react-app [my-app]
Create Vite project$ npm init vite@latest [my-app]
Set default author$ npm config set init-author-name "[name]"
SYNOPSIS
npm init [options] [initializer]
DESCRIPTION
npm init creates a new package.json file. Without an initializer, it prompts for package details. With an initializer, it runs that package's setup process.Initializers like "react-app" are shorthand for "create-react-app".
PARAMETERS
-y, --yes
Accept all defaults.--scope scope
Create scoped package.-w, --workspace
Create workspace.initializer
Package to run (create-*).
Interactive
npm init
Answer prompts...
With defaults
npm init -y
Using initializer (runs create-react-app)
npm init react-app my-app
Scoped package
npm init --scope=@myorg
$
# PACKAGE.JSON TEMPLATE
{"name": "my-package","version": "1.0.0","description": "","main": "index.js","scripts": { "test": "echo \"Error: no test\" && exit 1" },"keywords": [],"author": "","license": "ISC"}# PACKAGE.JSON TEMPLATE
$
# CAVEATS
-y uses defaults which may need editing. Initializers download packages. Workspace mode for monorepos.
# SEE ALSO
npm(1), npm-install(1), npm-config(1)
# CAVEATS
-y uses defaults which may need editing. Initializers download packages. Workspace mode for monorepos.
# SEE ALSO
npm(1), npm-install(1), npm-config(1)
