Passer au contenu principal
Version: 6.x

pnpm CLI

Différences avec npm

Contraitement à npm, pnpm valide toutes les options. For example, pnpm install --target_arch x64 will fail as --target_arch is not a valid option for pnpm install.

However, some dependencies may use the npm_config_ environment variable, which is populated from the CLI options. Dans ce cas, vous avez vous disposez des options suivantes:

  1. explicitly set the env variable: npm_config_target_arch=x64 pnpm install
  2. force the unknown option with --config.: pnpm install --config.target_arch=x64

Options

-C <path>, --dir <path>

Execute comme si pnpm avait été lancé dans <path> au lieu du répértoire de travail actuel.

-w, --workspace-root

Ajout : v5.6.0

Run as if pnpm was started in the root of the workspace instead of the current working directory.

Commandes

Pour plus d'informations, referez vous a la documentation pour la liste des commandes CLI. Here is a list of handy npm equivalents to get you started:

commande npméquivalent pnpm
npm installpnpm install
npm i <pkg>[pnpm add <pkg>]
npm run <cmd>[pnpm <cmd>]

When an unknown command is used, pnpm will search for a script with the given name, so pnpm run lint is the same as pnpm lint. If there is no script with the specified name, then pnpm will execute the command as a shell script, so you can do things like pnpm eslint (see pnpm exec).