npm init
New Node.js, package.json
Syntax
npm init [--yes] [<initializer>]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
() |
npm init |
Common | |
-y --yes |
npm init -y |
Common | |
<initializer> |
npm init vite@latest |
Common |
Examples
npm init -y
,
Vite
npm init vite@latest my-app
and more npx create-vite my-app
React
npm init react-app my-app
and more npx create-react-app my-app
npm config set init-author-name "Your Name" npm config set init-license MIT
npm init -y
Common Errors
npm ERR! already existspackage.json,
Invalid name,
Tips
- npm init -y New
- npm init <initializer> create-<initializer>
- package.json name