pnpm install
Aliases: i
pnpm install is used to install all dependencies for a project.
CI 環境では、ロックファイルが存在しても更新が必要な場合はインストールは失敗します。
Inside a workspace, pnpm install installs all dependencies in all the
projects. If you want to disable this behavior, set the recursive-install
setting to false.
TL;DR
| コマンド | 意味 | 
|---|---|
| pnpm i --offline | ストアからのみオフラインでインストールする | 
| pnpm i --frozen-lockfile | pnpm-lock.yamlis not updated | 
| pnpm i --lockfile-only | Only pnpm-lock.yamlis updated | 
Options for filtering dependencies
Without a lockfile, pnpm has to create one, and it must be consistent regardless of dependencies
filtering, so running pnpm install --prod on a directory without a lockfile would still resolve the
dev dependencies, and it would error if the resolution is unsuccessful. The only exception for this rule
are link: dependencies.
Without --frozen-lockfile, pnpm will check for outdated information from file: dependencies, so
running pnpm install --prod without --frozen-lockfile on an environment where the target of file:
has been removed would error.
--prod, -P
- Default: false
- Type: Boolean
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.
--no-optional
optionalDependencies are not installed.
Options
--force
依存関係の強制再インストール: ストアで変更されたパッケージを再取得し、互換性のないバージョンの 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.
依存パッケージがローカルで見つからない場合、インストールは失敗します。
--prefer-offline
- Default: false
- Type: Boolean
If true, staleness checks for cached data will be bypassed, but missing data
will be requested from the server. To force full offline mode, use --offline.
--no-lockfile
Don't read or generate a pnpm-lock.yaml file.
--lockfile-only
- Default: false
- Type: Boolean
When used, only updates pnpm-lock.yaml and package.json. Nothing gets written to the node_modules directory.
--fix-lockfile
破損した lockfile の項目を自動的に修正します。
--frozen-lockfile
- デフォルト:
- For non-CI: false
- For CI: true, if a lockfile is present
 
- 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. 以下のコードが CI 環境の検出に使用されています。
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>
- デフォルト:
- For TTY stdout: default
- For non-TTY stdout: append-only
 
- Type: default, append-only, ndjson, silent
インストールの進行状況のデバッグ情報をターミナルにログ出力するレポーターを設定できます。
- silent - no output is logged to the console, not even fatal errors
- default - the default reporter when the stdout is TTY
- append-only - the output is always appended to the end. カーソル操作を行いません。
- 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
Deprecated feature
バックグラウンドでストアサーバーを起動します。 インストールが完了した後も、ストアサーバーは実行し続けます。 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
Do not execute any scripts defined in the project package.json and its
dependencies.
--filter <package_selector>
--resolution-only
resolution の再実行: peer dependency の問題を表示するために役立ちます。
--cpu=<name>
Added in: v10.14.0
Override CPU architecture of native modules to install. Acceptable values are same as cpu field of package.json, which comes from process.arch.
--os=<name>
Added in: v10.14.0
Override OS of native modules to install. Acceptable values are same as os field of package.json, which comes from process.platform.
--libc=<name>
Added in: v10.14.0
Override libc of native modules to install. Acceptable values are same as libc field of package.json.