본문으로 건너뛰기
버전: 9.x

pnpm exec

프로젝트 범위에서 셸 명령을 실행합니다.

node_modules/.bin is added to the PATH, so pnpm exec allows executing commands of dependencies.

예시

If you have Jest as a dependency of your project, there is no need to install Jest globally, just run it with pnpm exec:

pnpm exec jest

The exec part is actually optional when the command is not in conflict with a builtin pnpm command, so you may also just run:

pnpm jest

옵션

Any options for the exec command should be listed before the exec keyword. Options listed after the exec keyword are passed to the executed command.

Good. pnpm은 재귀적으로 실행됩니다.

pnpm -r exec jest

Bad, pnpm will not run recursively but jest will be executed with the -r option:

pnpm exec jest -r

--recursive, -r

워크스페이스 내의 모든 프로젝트에서 셸 명령을 실행합니다.

The name of the current package is available through the environment variable PNPM_PACKAGE_NAME.

예시

Prune node_modules installations for all packages:

pnpm -r exec rm -rf node_modules

모든 패키지에 대한 패키지 정보를 봅니다. This should be used with the --shell-mode (or -c) option for the environment variable to work.

pnpm -rc exec pnpm view \$PNPM_PACKAGE_NAME

--no-reporter-hide-prefix

Do not hide prefix when running commands in parallel.

--resume-from <package_name>

Resume execution from a particular project. This can be useful if you are working with a large workspace and you want to restart a build at a particular project without running through all of the projects that precede it in the build order.

--parallel

Completely disregard concurrency and topological sorting, running a given script immediately in all matching packages. 긴 빌드 프로세스와 같은 많은 패키지에 대한 장기 실행 프로세스에서 선호되는 플래그입니다.

--shell-mode, -c

쉘 내부에서 명령을 실행합니다. Uses /bin/sh on UNIX and \cmd.exe on Windows.

--report-summary

Read about this option in the run command docs

--filter <package_selector>

Read more about filtering.