Passer au contenu principal
Version : 8.x

pnpm install

Alias: i

pnpm install est utilisé pour installer toutes les dépendances d'un projet.

Dans un environnement CI, l'installation échoue si un fichier de verrouillage est présent mais nécessite une mise à jour.

Dans un espace de travail workspace , pnpm install toutes les dépendances dans tous les projets. Si vous souhaitez désactiver ce comportement, définissez le paramètre recursive-install sur false.

TL;DR

CommandMeaning
pnpm i --offlineInstaller hors ligne à partir du magasin uniquement
pnpm i --frozen-lockfilepnpm-lock.yaml n'est pas mis à jour
pnpm i --lockfile-onlySeul pnpm-lock.yaml est mis à jour

Options

--force

Force reinstall dependencies: refetch packages modified in store, recreate a lockfile and/or modules directory created by a non-compatible version of pnpm. Install all optionalDependencies even they don't satisfy the current environment(cpu, os, arch).

--offline

  • Default: false
  • Type: Boolean

If true, pnpm will use only packages already available in the store. If a package won't be found locally, the installation will fail.

--prefer-offline

  • Default: false
  • Type: Boolean

Si true, les vérifications d'obsolescence des données mises en cache seront ignorées, mais les données manquantes seront demandées au serveur. Pour forcer le mode hors ligne complet, utilisez --offline.

--prod, -P

pnpm will not install any package listed in devDependencies and will remove those insofar they were already installed, if the NODE_ENV environment variable is set to production. Use this flag to instruct pnpm to ignore NODE_ENV and take its production status from this flag instead.

--dev, -D

Only devDependencies are installed and dependencies are removed insofar they were already installed, regardless of the NODE_ENV.

--no-optional

optionalDependencies ne sont pas installées.

--lockfile-only

  • Default: false
  • Type: Boolean

Lorsqu'il est utilisé, ne met à jour que pnpm-lock.yaml et package.json. Rien n'est écrit dans le répertoire node_modules.

--fix-lockfile

Correction automatique des entrées "lockfile" cassées.

--frozen-lockfile

  • Par défaut:
    • Pour non-CI : false
    • Pour CI : true, si un fichier lockfile est présent
  • Type: Boolean

If true, pnpm doesn't generate a lockfile and fails to install if the lockfile is out of sync with the manifest / an update is needed or no lockfile is present.

This setting is true by default in CI environments. The following code is used to detect CI environments:

https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61
exports.isCI = !!(
env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
env.BUILD_NUMBER || // Jenkins, TeamCity
env.RUN_ID || // TaskCluster, dsari
exports.name ||
false
)

--reporter=<name>

  • Par défaut:
    • Pour la sortie standard TTY : default
    • Pour la non-sortie standard TTY : append-only
  • Type : default, append-only, ndjson, silent

Allows you to choose the reporter that will log debug info to the terminal about the installation progress.

  • silent - no output is logged to the console, not even fatal errors
  • default - l'avertisseur par défaut lorsque la sortie standard est TTY
  • append-only - the output is always appended to the end. No cursor manipulations are performed
  • ndjson - the most verbose reporter. Prints all logs in ndjson format

If you want to change what type of information is printed, use the loglevel setting.

--use-store-server

  • Default: false
  • Type: Boolean

Starts a store server in the background. The store server will keep running after installation is done. To stop the store server, run pnpm server stop

--shamefully-hoist

  • Default: false
  • Type: Boolean

Creates a flat node_modules structure, similar to that of npm or yarn. WARNING: This is highly discouraged.

--ignore-scripts

  • Default: false
  • Type: Boolean

N'exécutez aucun script défini dans le projet package.json et ses dépendances .

--filter <package_selector>

Read more about filtering.

--resolution-only

Added in: v8.3.0

Re-runs resolution: useful for printing out peer dependency issues.