π Global npm package migration tool β effortlessly migrate the global packages you rely on when switching Node.js versions.
Switching Node.js versions is common, but it brings recurring headaches:
- π Frequent Node.js upgrades mean re-testing every toolchain.
- π¦ Globally installed CLIs vanish after a version switch.
- β° Reinstalling dozens of tools manually is tedious and error-prone.
- π§ Different package managers (npm/yarn/pnpm) keep separate global stores.
global-pack-sync exists to remove that friction.
β¨ Smart version management
- π Installs the latest releases by default to avoid security issues.
- π Lock to the exact versions captured in a snapshot when required.
- π See version changes clearly before you apply them.
β‘ High-performance installs
- π Parallel installation dramatically accelerates migrations.
- π― Skips packages that already exist globally.
- π Generates retry scripts automatically if installs fail.
π Multi package-manager support
- π¦ Works with npm, yarn, and pnpm.
- π Auto-detects the manager in use.
- π§ Override the manager explicitly when needed.
π¨ Improved developer experience
- π Colorful terminal output with clear progress updates.
- π Detailed status messages during save and restore operations.
- π Interactive selective restore for partial migrations.
- π Diff saved profiles to compare environments quickly.
π‘ Safe and stable
- π Process lock prevents concurrent runs from clashing.
- π« Filters out core packages (npm, corepack, global-pack-sync, etc.).
- πΎ Automatically backs up the configuration file before overwriting.
# Install globally with npm
npm install -g global-pack-sync
# Or with yarn
yarn global add global-pack-sync
# Or with pnpm
pnpm add -g global-pack-syncTip: You can also run the CLI with the short alias
gps.
# 1. Save the current global packages
global-pack-sync save
# 2. Switch to a different Node.js version
nvm use 18.0.0 # or n 18.0.0
# 3. Restore global packages in the new environment (latest versions by default)
global-pack-sync restoreThat's it! π
# Capture the current global package list
global-pack-sync save
# Save to a named profile
global-pack-sync save my-project-packages
# Detailed output example
β Saved profile "node-v18.17.0-1693123456789"
Node version: v18.17.0
npm version: 9.6.7
Package manager: npm
Package count: 15
Saved at: ~/.global-pack-sync/packages.json# Restore the most recent profile (installs latest versions)
global-pack-sync restore
# Restore a specific profile
global-pack-sync restore my-project-packages
# Use the exact versions captured previously
global-pack-sync restore --exact-version
# Specify manager and concurrency
global-pack-sync restore --pm yarn --concurrency 5Need only part of the toolchain? Use the interactive selector:
global-pack-sync select
# Prompt preview
Use β/β to move, space to toggle selection, a toggles all, Enter confirms, q cancels.
> [x] @vue/cli@5.0.8
[ ] create-react-app@5.0.1
[x] typescript@5.2.2
[x] nodemon@3.0.1
[ ] pm2@5.3.0β/βmove the cursor.spacetoggles the highlighted package.aswitches between select-all and select-none.Enterinstalls the current selection (everything starts selected).qcancels without installing anything.
A: Latest releases usually include security and bug fixes. When you must pin exact versions, pass --exact-version.
A: The tool skips core utilities to avoid conflicts:
npm,npxβ npm core toolscorepackβ Node.js built-in package managernode-gypβ typically auto-installed as part of buildsglobal-pack-syncβ the CLI itself
A: A retry script (~/.global-pack-sync/retry-failed.sh) is generated. Run it manually or tweak and retry.
A: Yes. It uses your current npm configuration, including auth tokens and custom registries.
A: Most packages work fine. Packages with native modules may need recompilation. Platform information is stored for reference.
# macOS/Linux
sudo global-pack-sync restore
# Or repair npm permissions
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile# Point npm to a mirror
npm config set registry https://registry.npmmirror.com
# Or fall back to npm temporarily
global-pack-sync restore --pm npm# Remove saved profiles
rm -rf ~/.global-pack-sync
# Start fresh
global-pack-sync saveContributions are welcome! See CONTRIBUTING.md for guidelines.
# Clone the repo
git clone https://github.com/YangsonHung/global-pack-sync.git
cd global-pack-sync
# Install dependencies
yarn install
# Build once (outputs to dist/)
yarn build
# Run the CLI locally
node dist/cli.js --help
# Run tests
yarn test- Added a GitHub Actions workflow that builds, tests, and publishes releases whenever a version tag is pushed.
- Packaged the compiled
dist/output with each GitHub release asset. - Documented the automated release flow for new contributors.
gpsis now available as a short alias for all CLI commands.- The
selectcommand uses an interactive selector with non-TTY fallback. - Documentation gained alias and selector control hints in English and Chinese.
- Fixed the published CLI bin path and polished npm badge metadata.
- Streamlined release scripting and added repository formatting workflows.
- Initial release with save/restore commands and profile storage.
- Added build/test tooling and project documentation.
See CHANGELOG.md for the full history.
MIT License Β© 2025
- π Project homepage
- π Issue tracker
- π Wiki
- π¬ Discussions
If this tool helps you, please leave us a β star!
Happy coding! π