Skip to content

vp add ​

Add packages to the project and update its manifest and lockfile.

bash
vp add react
vp add -D typescript
vp add --save-peer react
vp add --filter web react

Options ​

Choose one dependency target at a time. Peer dependencies follow the native manager's behavior, including whether it also records a development dependency.

OptionDescriptionNotes
-P, --save-prodSave to dependencies, the default target.Choose one dependency target.
-D, --save-devSave to devDependencies.Choose one dependency target.
--save-peerRequest the manager's peer-dependency save behavior.Choose one dependency target.
-O, --save-optionalSave to optionalDependencies.Choose one dependency target.
-E, --save-exactSave an exact dependency version.
--save-catalog-name <name>Save the dependency to a named catalog.
--save-catalogSave the dependency to the default catalog.
--allow-build <names>Allow the named packages to run postinstall scripts.
--ignore-scriptsDo not run lifecycle scripts.
--no-optionalDo not install optionalDependencies.Cannot be combined with --global.
--frozen-lockfilePrevent lockfile changes.Cannot be combined with --global. Overrides an earlier --no-frozen-lockfile.
--no-frozen-lockfileExplicitly allow lockfile updates.Cannot be combined with --global. Overrides an earlier --frozen-lockfile.
--lockfile-onlyUpdate the lockfile without a full install.Cannot be combined with --global.
--prefer-offlineUse cached packages when available.Cannot be combined with --global.
--offlineOnly use packages already in cache.Cannot be combined with --global.
-f, --forceRequest a forced reinstall.Cannot be combined with --global.
--no-lockfileSkip reading or generating a lockfile.Cannot be combined with --global.
--shamefully-hoistCreate a flat node_modules layout.Cannot be combined with --global.
--silentSuppress Vite+ output and request native quiet output.Cannot be combined with --global.
--filter <pattern>Select workspaces by pattern.Can be repeated.
-w, --workspace-rootAdd to workspace root.
--workspaceRequire the dependency to exist in the workspace.
-g, --globalInstall globally.Requires the global CLI. Uses the global package store.
--node <version>Node.js version to use for global installation.Requires --global.
--concurrency <number>Number of global package installs to run in parallel.Requires --global. Must be a positive integer.

Compatibility ​

The commands below describe project operations. Global mode is described under Options.

  • npm: npm install.
  • pnpm: pnpm add.
  • Yarn Classic: yarn add.
  • Yarn Modern: yarn add.
  • Bun: bun add.
OptionnpmpnpmYarn ClassicYarn ModernBunNotes
-P, --save-prodYesYesYesYesYes
-D, --save-devYesYesYesYesYes
--save-peerYesYesYesYesYes
-O, --save-optionalYesYesYesYesYes
-E, --save-exactYesYesYesYesYes
--save-catalog-name <name>NoYesNoNo1.4 or later
--save-catalogNoYesNoNo1.4 or later
--allow-build <names>NoYesNoNoNo
--ignore-scriptsYesYesYesYesYesOn Yarn Modern, lockfile-only mode takes priority.
--no-optionalYesYesYesNoYes
--frozen-lockfileNoNoYesNoYes
--no-frozen-lockfileNoNoNoNoYes
--lockfile-onlyYesYesNo3 or laterYes
--prefer-offlineYesYesYesNo1.4.1 or later
--offlineYesYesYesNo1.4.1 or later
-f, --forceYesYesYesNoYes
--no-lockfileYesYesYesNoNo
--shamefully-hoistNoYesNoNoNo
--silentYesYesYesNoYes
--filter <pattern>YesYesNoYes1.4 or later
-w, --workspace-rootYesYesYesNoNo
--workspaceNoYesNoNoNo
-g, --globalYesYesYesYesYes
--node <version>YesYesYesYesYes
--concurrency <number>YesYesYesYesYes

Native Options ​

For native options, see npm install, pnpm add, Yarn add, Yarn Classic add, and Bun add. To pass these options through Vite+, see Native Arguments.