pnpm CLI
npm との違い
npm とは異なり、pnpm はすべてのオプションを検証します。 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. この場合、次の選択肢があります。
- explicitly set the env variable:
npm_config_target_arch=x64 pnpm install - force the unknown option with
--config.:pnpm install --config.target_arch=x64
Options
-C <path>, --dir <path>
Run as if pnpm was started in <path> instead of the current working directory.
-w, --workspace-root
Run as if pnpm was started in the root of the workspace instead of the current working directory.
コマンド
詳細については、個別の CLI コマンドのドキュメントを参照してください。 以下は、簡単な npm との対応表です。
| npm のコマンド | pnpm で同等のコマンド |
|---|---|
npm install | pnpm 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).