Passa al contenuto principale
Versione: 8.x

pnpm install

Alias: i

pnpm install viene utilizzato per installare tutte le dipendenze di un progetto.

In un ambiente CI, l'installazione fallisce se un lockfile è presente ma necessita di un aggiornamento.

All'interno di uno spazio di lavoro, pnpm install installa tutte le dipendenze in tutti i progetti. Se vuoi disabilitare questo comportamento, imposta l'opzione recursive-install a false.

TL;DR

ComandoSignificato
pnpm i --offlineInstalla offline solo dall'archivio
pnpm i --frozen-lockfilepnpm-lock.yaml non viene aggiornato
pnpm i --lockfile-onlySolo pnpm-lock.yaml viene aggiornato

Opzioni

--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

  • Predefinito: false
  • Tipo: Booleano

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

  • Predefinito: false
  • Tipo: Booleano

Se true, i controlli di obsolescenza per i dati memorizzati nella cache verranno ignorati, ma i dati mancanti verranno richiesti dal server. Per forzare la modalità offline completa, utilizzare --offline.

--prod, -P

  • Predefinito:
    • If NODE_ENV is production: true
    • If NODE_ENV is not production: false
  • Type: Boolean

If set, pnpm will ignore NODE_ENV and instead use this boolean value for determining the environment.

If true, pnpm will not install any package listed in devDependencies and will remove those insofar they were already installed. If false, pnpm will install all packages listed in devDependencies and dependencies.

--dev, -D

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

--no-optional

Le dipendenze opzionali (optionalDependencies) non vengono installate.

--lockfile-only

  • Predefinito: false
  • Tipo: Booleano

Se utilizzato, aggiorna solo pnpm-lock.yaml e package.json. Non viene scritto nulla nella cartella node_modules.

--fix-lockfile

Correggi automaticamente le voci del file di blocco non funzionanti.

--frozen-lockfile

  • Predefinito:
    • Per non CI: false
    • Per CI: true, se è presente un lockfile
  • Tipo: Booleano

Se true, pnpm non genera un lockfile e l'installazione fallisce se il lockfile è fuori sincronizzazione con il manifesto / un aggiornamento è necessario o nessun lockfile è presente.

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
)

--merge-git-branch-lockfiles

Merge all git branch lockfiles. Read more about git branch lockfiles.

--reporter=<name>

  • Predefinito:
    • Per TTY stdout: default
    • Per stdout non 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 - nessun output viene registrato nella console, neanche degli errori fatali
  • default - il segnalatore predefinito quando lo stdout è TTY
  • append-only - l'output viene sempre aggiunto alla fine. Non vengono eseguite manipolazioni del cursore
  • ndjson - il segnalatore più verboso. Stampa tutti i log nel formato ndjson

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

--use-store-server

  • Predefinito: false
  • Tipo: Booleano

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

  • Predefinito: false
  • Tipo: Booleano

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

--ignore-scripts

  • Predefinito: false
  • Tipo: Booleano

Do not execute any scripts defined in the project package.json and its dependencies.

--filter <package_selector>

warning

Filter currently does not work properly with v8 default config, you have to implicitly set dedupe-peer-dependents to false to have that work. For more info and progress please refer to #6300

Ulteriori informazioni sui filtri.

--resolution-only

Aggiunto nella versione: v8.3.0

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