package-management
π―Skillfrom qingqishi/shiqingqi.com
Manages package dependencies using pnpm and corepack, automatically handling package manager versions and installations via the packageManager field.
Installation
npx skills add https://github.com/qingqishi/shiqingqi.com --skill package-managementSkill Details
Package management using pnpm and corepack with packageManager field in package.json. This skill should be used when installing dependencies, upgrading packages, troubleshooting package manager issues, or working with pnpm commands. Explicit triggers include "upgrade pnpm", "update pnpm", "pnpm version", "pnpm install", "pnpm add", "corepack", "package installation", "dependency updates", or "packageManager field".
Overview
# Package Management
Overview
This project uses pnpm as the package manager, with corepack to manage pnpm versions automatically.
Corepack Integration
How It Works
- pnpm version is specified in
package.jsonunder thepackageManagerfield - corepack automatically uses the exact version specified
- No need to manually install pnpm - corepack handles it
Example from package.json
```json
{
"packageManager": "pnpm@9.1.0"
}
```
When you run pnpm commands, corepack ensures version 9.1.0 is used.
Common Commands
Installing Dependencies
```bash
pnpm install
```
This installs all dependencies from package.json using the version specified in the packageManager field.
Adding New Dependencies
```bash
# Production dependency
pnpm add
# Development dependency
pnpm add -D
```
Upgrading pnpm
To upgrade pnpm to the latest version:
```bash
corepack use pnpm@latest
```
This command:
- Updates to the latest pnpm version
- Automatically updates
package.json'spackageManagerfield - Ensures the team uses the same version
Upgrading to Specific pnpm Version
```bash
corepack use pnpm@9.5.0
```
Troubleshooting
Signature Verification Errors
If you encounter signature verification errors when running pnpm commands:
```bash
npm install -g corepack@latest
```
This updates corepack itself, which can resolve verification issues.
pnpm Command Not Found
If pnpm is not recognized:
- Enable corepack (if not already enabled):
```bash
corepack enable
```
- Install the project's pnpm version:
```bash
corepack install
```
Wrong pnpm Version
If the wrong pnpm version is being used:
- Check the version specified in
package.json:
```json
{
"packageManager": "pnpm@X.Y.Z"
}
```
- Ensure corepack is enabled:
```bash
corepack enable
```
- Re-run your command - corepack should download the correct version
Best Practices
- Never install pnpm globally - Let corepack manage it
- Use
corepack use pnpm@latestto upgrade, not manual installation - Commit
package.jsonchanges when upgrading pnpm (thepackageManagerfield) - Don't mix package managers - Always use pnpm, never npm or yarn
Why Corepack?
Benefits
- Version consistency - Everyone uses the same pnpm version
- No manual installation - Corepack handles pnpm installation
- Automatic switching - Different projects can use different pnpm versions
- Lockfile compatibility - Ensures
pnpm-lock.yamlis compatible
How It's Different from Manual Installation
With corepack (this project):
```bash
# Just run pnpm - corepack handles the rest
pnpm install
```
Without corepack:
```bash
# Manual installation needed
npm install -g pnpm@9.1.0
pnpm install
```
Integration with CI/CD
In CI/CD environments, ensure corepack is enabled:
```bash
# Enable corepack first
corepack enable
# Then run pnpm commands
pnpm install
pnpm build
```
Most modern CI environments (GitHub Actions, etc.) have corepack pre-installed.
Common Workflows
First-time Setup
```bash
# 1. Enable corepack (if needed)
corepack enable
# 2. Install dependencies
pnpm install
# 3. Start development
pnpm dev
```
Upgrading All Dependencies
```bash
# Update all dependencies to latest versions
pnpm update --latest
# Or use interactive mode
pnpm update --interactive --latest
```
Checking Outdated Packages
```bash
pnpm outdated
```
Deduplicate Dependencies
```bash
pnpm dedupe
```
This removes duplicate packages from pnpm-lock.yaml, reducing installation size.
Key Reminders
- β
Use
corepack use pnpm@latestto upgrade pnpm - β
Commit
package.jsonchanges when pnpm version changes - β Enable corepack before using pnpm
- β Don't install pnpm globally with npm
- β Don't manually edit the
packageManagerfield
More from this repository5
Streamlines React 19 context and compiler patterns, providing optimized syntax for Context.Provider, use() hook, and automatic memoization.
Enables responsive and theme-aware styling using StyleX design tokens, breakpoints, and custom CSS prop for consistent component design.
Generates selective Zod schemas and TypeScript types for TMDB API endpoints, optimizing performance and enabling AI-powered structured outputs.
Streamlines API data retrieval with intelligent caching, error handling, and flexible request configurations for modern web applications.
Enables user-centric end-to-end testing with Playwright using semantic locators and best practices that focus on visible behavior.