pnpm add <pkg>
패키지와 패키지가 의존하는 모든 패키지를 설치합니다. 기본적으로 새 패키지는 프로덕션 의존성으로 설치됩니다.
요약
| 명령어 | 의미 |
|---|---|
pnpm add sax | dependencies에 저장 |
pnpm add -D sax | devDependencies에 저장 |
pnpm add -O sax | optionalDependencies에 저장 |
pnpm add -g sax | 패키지를 전역으로 설치합니다 |
pnpm add sax@next | next 태그로부터 설치 |
pnpm add sax@3.0.0 | 3.0.0 버전 명시 |
Supported package sources
pnpm supports installing packages from various sources. See the Supported package sources page for detailed documentation on:
- npm registry
- JSR registry
- Workspace packages
- Local file system (tarballs and directories)
- Remote tarballs
- Git repositories (with semver, subdirectories, and more)
옵션
--save-prod, -P
지정된 패키지를 일반 dependencies로 설치합니다.
--save-dev, -D
지정된 패키지를 devDependencies로 설치합니다.
--save-optional, -O
지정된 패키지를 optionalDependencies로 설치합니다.
--save-exact, -E
저장된 의존성은 pnpm의 기본 semver 범위 연산자를 사용하지 않고 정확한 버전으로 구성됩니다.
--save-peer
--save-peer 를 사용하면 하나 이상의 패키지가 peerDependencies 에 추가되고 dev 의존성으로 설치됩니다.
--save-catalog
Added in: v10.12.1
Save the new dependency to the default catalog.
--save-catalog-name <catalog_name>
Added in: v10.12.1
Save the new dependency to the specified catalog.
--config
Added in: v10.8.0
Save the dependency to configDependencies.
--ignore-workspace-root-check
--ignore-workspace-root-check 또는 -w 플래그를 사용하지 않으면, 루트 워크스페이스 패키지에 새 의존성을 추가하는 데 실패합니다.
예를 들어, pnpm add debug -w 와 같이 사용할 수 있습니다.
--global, -g
패키지를 전역으로 설치합니다.
--workspace
워크스페이스에서 발견된 경우에만 새 의존성을 추가합니다.
--allow-build
Added in: v10.4.0
A list of package names that are allowed to run postinstall scripts during installation.
예시:
pnpm --allow-build=esbuild add my-bundler
This will run esbuild's postinstall script and also add it to the onlyBuiltDependencies field of pnpm-workspace.yaml. So, esbuild will always be allowed to run its scripts in the future.
--filter <package_selector>
--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.