PNPM - Windows 11 Installation
pnpm Setup Guide for Windows 11 - BigCommerce Catalyst Development
Section titled “pnpm Setup Guide for Windows 11 - BigCommerce Catalyst Development”A comprehensive guide to installing and using pnpm (Performant Node Package Manager) on Windows 11 for BigCommerce Catalyst development.
🎯 Why pnpm for Catalyst?
Section titled “🎯 Why pnpm for Catalyst?”BigCommerce Catalyst uses pnpm as their preferred package manager for several key reasons:
- Disk Space Efficiency: Saves up to 80% disk space compared to npm
- Faster Installation: Significantly faster than npm and yarn
- Strict Node Modules: Prevents phantom dependencies
- Monorepo Support: Better handling of complex project structures
- Content-Addressable Storage: Shared dependencies across projects
🛠 Installation Options
Section titled “🛠 Installation Options”Option 3: Using Chocolatey
Section titled “Option 3: Using Chocolatey”Install Chocolatey first (if not already installed)
Section titled “Install Chocolatey first (if not already installed)”Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Install pnpm via Chocolatey
Section titled “Install pnpm via Chocolatey”choco install pnpm
Verify installation
Section titled “Verify installation”pnpm --version
⚙️ Windows 11 Configuration
Section titled “⚙️ Windows 11 Configuration”PowerShell Execution Policy
Section titled “PowerShell Execution Policy”If you encounter execution policy errors:
# Check current execution policyGet-ExecutionPolicy
# Set execution policy for current user (if needed)Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Or for all users (requires admin)Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Environment Variables
Section titled “Environment Variables”Verify pnpm is in your PATH:
# Check if pnpm is in PATHecho $env:PATH
# If needed, add pnpm to PATH manually# Go to: System Properties > Environment Variables > User Variables# Add to PATH: C:\Users\YourUsername\AppData\Roaming\npm
Windows Terminal Configuration
Section titled “Windows Terminal Configuration”For the best development experience:
// Add to Windows Terminal settings.json{ "profiles": { "defaults": { "commandline": "powershell.exe", "startingDirectory": "C:\\dev\\projects" } }}
🚀 Basic pnpm Commands
Section titled “🚀 Basic pnpm Commands”Package Management
Section titled “Package Management”# Install dependencies (equivalent to npm install)pnpm install# or simplypnpm i
# Add a package (equivalent to npm install package)pnpm add package-name
# Add dev dependencypnpm add -D package-name
# Add global packagepnpm add -g package-name
# Remove packagepnpm remove package-name
# Update packagespnpm update
Project Scripts
Section titled “Project Scripts”# Run scripts (same as npm run)pnpm run devpnpm run buildpnpm run test
# Run script directly (no 'run' needed)pnpm devpnpm buildpnpm test
# Run script in specific workspacepnpm --filter workspace-name dev
Package Information
Section titled “Package Information”# List installed packagespnpm list
# Show package infopnpm info package-name
# Show outdated packagespnpm outdated
# Check for security vulnerabilitiespnpm audit
🔄 Migration from npm
Section titled “🔄 Migration from npm”Command Comparison
Section titled “Command Comparison”npm | pnpm | Description |
---|---|---|
npm install | pnpm install | Install dependencies |
npm install pkg | pnpm add pkg | Add package |
npm install -D pkg | pnpm add -D pkg | Add dev dependency |
npm install -g pkg | pnpm add -g pkg | Install globally |
npm uninstall pkg | pnpm remove pkg | Remove package |
npm run script | pnpm script | Run script |
npm update | pnpm update | Update packages |
npm list | pnpm list | List packages |
Migrating Existing Projects
Section titled “Migrating Existing Projects”# Remove existing node_modules and package-lock.jsonRemove-Item -Recurse -Force node_modulesRemove-Item package-lock.json
# Install with pnpmpnpm install
🎯 BigCommerce Catalyst Workflow
Section titled “🎯 BigCommerce Catalyst Workflow”Initial Project Setup
Section titled “Initial Project Setup”# Clone your Catalyst projectgit clone [your-catalyst-repo-url]cd [your-project-name]
# Install dependencies with pnpmpnpm install
# Start development serverpnpm dev
# Build for productionpnpm build
# Run testspnpm test
Development Workflow
Section titled “Development Workflow”# Add packages commonly used in your stackpnpm add @tailwindcss/typographypnpm add -D @types/node
# Run development with hot reloadingpnpm dev
# Lint and format codepnpm lintpnpm format
# Type checkingpnpm type-check
🏗 Advanced pnpm Features
Section titled “🏗 Advanced pnpm Features”Workspace Management
Section titled “Workspace Management”packages: - 'packages/*' - 'apps/*' - 'tools/*'
# Run command in all workspacespnpm -r run build
# Run command in specific workspacepnpm --filter my-app dev
# Add dependency to specific workspacepnpm --filter my-app add lodash
Configuration (.npmrc)
Section titled “Configuration (.npmrc)”Create .npmrc
in your project root:
# Enable strict peer dependenciesstrict-peer-dependencies=true
# Hoist patterns for better compatibilityhoist-pattern[]=*eslint*hoist-pattern[]=*prettier*
# Registry configurationregistry=https://registry.npmjs.org/
# Auto-install peer dependenciesauto-install-peers=true
Store Management
Section titled “Store Management”# Check store statuspnpm store status
# Cleanup unused packagespnpm store prune
# Verify store integritypnpm store verify
🛠 VS Code Integration
Section titled “🛠 VS Code Integration”Recommended Extensions
Section titled “Recommended Extensions”Install these VS Code extensions for optimal pnpm development:
{ "recommendations": [ "ms-vscode.vscode-typescript-next", "bradlc.vscode-tailwindcss", "esbenp.prettier-vscode", "ms-vscode.powershell" ]}
VS Code Settings
Section titled “VS Code Settings”Add to your VS Code settings.json:
{ "npm.packageManager": "pnpm", "terminal.integrated.defaultProfile.windows": "PowerShell", "typescript.preferences.includePackageJsonAutoImports": "on"}
🔧 Troubleshooting
Section titled “🔧 Troubleshooting”Common Windows Issues
Section titled “Common Windows Issues”PowerShell Execution Policy Error
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
pnpm command not found
# Restart terminal after installation# Or manually add to PATH
Permission Denied Errors
# Run PowerShell as Administrator# Or use --force flagpnpm install --force
Long Path Issues (Windows)
# Enable long paths in Windowsgit config --system core.longpaths true
Performance Optimization
Section titled “Performance Optimization”# Increase Node.js memory limit$env:NODE_OPTIONS="--max-old-space-size=4096"
# Use faster registry mirror (if needed)pnpm config set registry https://registry.npmjs.org/
# Enable network concurrencypnpm config set network-concurrency 16
📊 Performance Benefits
Section titled “📊 Performance Benefits”Benchmark Comparison (Typical Results)
Section titled “Benchmark Comparison (Typical Results)”Operation | npm | pnpm | Improvement |
---|---|---|---|
Install (fresh) | 45s | 18s | 60% faster |
Install (cached) | 12s | 3s | 75% faster |
Disk Usage | 150MB | 30MB | 80% smaller |
Catalyst Project Benefits
Section titled “Catalyst Project Benefits”- Faster CI/CD: Reduced installation time in deployment pipelines
- Lower Storage Costs: Significant disk space savings
- Better Development Experience: Faster dependency resolution
- Improved Reliability: Stricter dependency resolution prevents phantom dependencies
🎯 Next Steps
Section titled “🎯 Next Steps”- Install pnpm: Choose your preferred installation method
- Verify Setup: Run
pnpm --version
to confirm installation - Configure Environment: Set up PowerShell and VS Code integration
- Test with Catalyst: Clone and run your BigCommerce Catalyst project
- Optimize Workflow: Configure .npmrc and workspace settings
📚 Additional Resources
Section titled “📚 Additional Resources”- pnpm Official Documentation
- pnpm CLI Reference
- BigCommerce Catalyst with pnpm
- Windows Terminal Setup
🤝 Integration with Existing Workflow
Section titled “🤝 Integration with Existing Workflow”pnpm integrates seamlessly with your existing development tools:
- Zapier/Make.com: Use in automation scripts
- CI/CD Pipelines: Faster build times
- Docker: Smaller container images
- Retool: Faster development environment setup
Ready to supercharge your BigCommerce Catalyst development with pnpm! ⚡