node-linker-pro
Version:
Keep node_modules out of cloud sync folders by linking them to a local cache. Cross-platform. Includes global npm setup command.
153 lines (100 loc) β’ 3.72 kB
Markdown
# node-linker-pro
[](https://www.npmjs.com/package/node-linker-pro)
[](https://www.npmjs.com/package/node-linker-pro)
[](LICENSE)
πΎ **Keep `node_modules` out of cloud sync folders** by linking them to a local cache.
β‘ **Cross-platform**: macOS, Linux, and Windows.
π¦ **One-step global command**: `npm setup`.
## Why this exists
If your projects live in cloud-synced folders like Google Drive, OneDrive, Dropbox, or iCloud, youβve likely seen these problems:
β Slow syncs β `node_modules` can be hundreds of MBs.
β Wasted storage β dependencies donβt need to be backed up.
β CPU/bandwidth drain while coding.
β
Save cloud storage space.
β
Faster project syncs.
β
No changes to your workflow.
## The solution
`node-linker-pro` moves your `node_modules` to a local cache folder outside
cloud sync, then creates a link back so your project works exactly the same.
### Before
```text
/Google Drive/MyProject
package.json
node_modules/ β huge folder synced to the cloud
```
### After
```text
/Google Drive/MyProject
package.json
node_modules β /Users/you/Library/Caches/node_modules_store/<hash>
```
βΉοΈ **`<hash>`** is a unique folder name based on your project path, ensuring no conflicts between different projects.
## Features
- πΎ Save cloud storage space.
- β‘ Faster project syncs.
- π Cross-platform: macOS, Linux, Windows.
- π¦ Works with npm, Yarn, and pnpm.
- π Auto-installs missing dependencies.
- π No changes to your `package.json`.
## Installation
Install globally once:
```bash
npm i -g node-linker-pro
```
## Usage
From any project folder:
```bash
npm setup
```
This will:
1. Move `node_modules` to the cache folder.
2. Create a symlink (mac/Linux) or junction (Windows).
3. Install dependencies if the cache is empty.
If your npm version doesnβt support `npm setup`:
```bash
npm-setup
```
## Cache locations
| OS | Default cache path |
| ------- | ------------------------------------------------ |
| macOS | `~/Library/Caches/node_modules_store` |
| Linux | `~/.cache/node_modules_store` |
| Windows | `%LOCALAPPDATA%\Temp\node_modules_cache` |
Custom path:
```bash
# mac/Linux
EXTERNAL_NODE_MODULES_DIR="/path/to/cache" npm setup
```
```powershell
# Windows PowerShell
$env:EXTERNAL_NODE_MODULES_DIR="D:\path\to\cache"; npm setup
```
## When to use it
β
You keep projects in Google Drive, OneDrive, Dropbox, or iCloud.
β
You want a cross-platform, cloud-safe workflow.
β
You switch between multiple OSes and donβt want to re-download dependencies.
## When not to use it
β CI/CD pipelines (use `npm ci` instead).
β Highly isolated builds requiring separate installs for security.
## FAQ
**Will it break my project?**
No. Your tools see `node_modules` normally.
**What if the cache is deleted?**
Run `npm setup` again β dependencies will reinstall.
**Does it require admin rights on Windows?**
No, if Developer Mode is enabled. Otherwise, Windows may ask.
## License
MIT β Free to use, modify, and share.
- **npm:** [node-linker-pro on npm](https://www.npmjs.com/package/node-linker-pro)
- **GitHub:** [node-linker-pro on Github](https://github.com/RomFatal/node-linker-pro)