Saltar al contenido principal
Version: Próxima versión

pnpm install

Alias: i

pnpm install es usado para instalar las dependencias del projecto.

En ambiente CI, la installación falla si el lockfile existe pero necesita ser actualizado.

Dentro de un workspace, pnpm install instala todas las dependencias en todos los proyectos. Si deseas desactivar este comportamiento, define la configuraciónrecursive-install a false.

TL;DR

ComandoSignificado
pnpm i --offlineInstala modo offline desde el almacenamiento interno
pnpm i --frozen-lockfilepnpm-lock.yaml no es actualizado
pnpm i --lockfile-onlySolo pnpm-lock.yaml es actualizado

Opciones

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

  • Por defecto: false
  • Tipo: 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

  • Por defecto: false
  • Tipo: Boolean

Si verdadero, se omitirán las comprobaciones de obsolescencia de los datos almacenados en caché, pero los datos faltantes se solicitarán al servidor. Para forzar el modo offline, usa --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 no son instaladas.

--lockfile-only

  • Por defecto: false
  • Tipo: Boolean

When used, only updates pnpm-lock.yaml and package.json. Nothing gets written to the node_modules directory.

--fix-lockfile

Arregla las entradas lockfile roto automaticamente.

--frozen-lockfile

  • Por defecto
    • No para CI: false
    • Para CI: true, si lockfile esta presente
  • Tipo: 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>

  • Por defecto
    • Para TTY stdout: default
    • Sin non-TTY stdout: append-only
  • Tipo: 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 - el reporte por defecto cuando la salida stdout es TTY
  • append-only - the output is always appended to the end. No se realizan manipulaciones del cursor
  • ndjson - el reporte con más detalle. Imprime todas las salidas en formato ndjson

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

--use-store-server

  • Por defecto: false
  • Tipo: 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

  • Por defecto: false
  • Tipo: Boolean

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

--ignore-scripts

  • Por defecto: false
  • Tipo: Boolean

No ejecuta ningún sript definido en el proyecto package.json y sus dependencias.

--filter <package_selector>

Leer más acerca del filtrado.

--resolution-only

Agregado en: v8.3.0

Resolución de re-ejecución: útil para imprimir problemas de dependencia entre pares.