This project now uses pnpm as its package manager for better performance and disk space efficiency.
- Faster installations: pnpm is up to 2x faster than npm
- Disk space efficient: pnpm uses a content-addressable storage, saving gigabytes of disk space
- Stricter package resolution: Helps prevent "works on my machine" issues
- Better monorepo support: If the project grows
npm install -g pnpm# Remove node_modules and package-lock.json
rm -rf node_modules package-lock.jsonpnpm install| npm command | pnpm equivalent |
|---|---|
npm install |
pnpm install |
npm install <pkg> |
pnpm add <pkg> |
npm install -D <pkg> |
pnpm add -D <pkg> |
npm install -g <pkg> |
pnpm add -g <pkg> |
npm uninstall <pkg> |
pnpm remove <pkg> |
npm run <script> |
pnpm <script> or pnpm run <script> |
npm test |
pnpm test |
npm run build |
pnpm build |
# Install dependencies
pnpm install
# Run in development mode
pnpm dev <url>
# Build the project
pnpm build
# Run tests
pnpm test
# Clean temporary files
pnpm cleanMake sure pnpm is installed globally:
npm install -g pnpmIf you get permission errors, you might need to configure npm's global directory:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g pnpmIf you're working in a team, make sure everyone switches to pnpm:
- Delete
package-lock.json - Commit
pnpm-lock.yamlinstead - Update CI/CD pipelines to use pnpm
If you're using GitHub Actions or other CI/CD:
# Example GitHub Actions update
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build