This Windows-specific error occurs when npm can't create junctions (directory symlinks) due to permission issues. Usually requires running as Administrator or enabling Windows Developer Mode.
Fixes npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction
cd C:\path\to\your\projectcd C:\path\to\your\projectnpm ERR! code EPERMnpm ERR! EPERM: operation not permitted, junction
On this page
The EPERM error with "junction" is a Windows-specific issue. Junctions are Windows directory links (similar to symlinks on Unix). npm uses junctions on Windows for linking packages, but creating them requires elevated permissions or special configuration. This typically happens when: - Running npm without Administrator privileges - Windows Developer Mode isn't enabled - Antivirus software (especially Windows Defender) blocks the operation - Another process has files locked in node_modules npm prefers junctions over symlinks on Windows because junctions don't require the SeCreateSymbolicLinkPrivilege. However, certain conditions can still block junction creation.
First, close any applications that might have node_modules files open:
- Close Visual Studio Code or your IDE
- Stop any running dev servers (Ctrl+C)
- Close any terminal windows in the project directory
Then retry npm install.
Developer Mode allows symlink/junction creation without admin rights:
1. Open Settings (Win + I)
2. Go to Update & Security → For developers
3. Turn on Developer Mode
4. Restart your terminal and retry npm install
If Developer Mode doesn't help:
1. Right-click on Command Prompt or PowerShell
2. Select Run as administrator
3. Navigate to your project:
cd C:\path\to\your\project4. Run npm install:
npm installRemove any corrupted state:
npm cache clean --force
rmdir /s /q node_modules
del package-lock.json
npm installIf node_modules is marked read-only:
1. Right-click the node_modules folder
2. Select Properties
3. Uncheck Read-only
4. Click Apply and select Apply to all subfolders and files
Or via command line:
attrib -r node_modules /s /dIf Windows Defender is interfering:
1. Open Windows Security
2. Go to Virus & threat protection
3. Click Manage settings
4. Temporarily turn off Real-time protection
5. Run npm install
6. Re-enable Real-time protection after installation
Or add your project folder to exclusions instead.
Why junctions, not symlinks?: On Windows, creating symlinks requires the SeCreateSymbolicLinkPrivilege, which normally requires admin rights. Junctions don't have this requirement, so npm prefers them. However, junction creation can still fail due to permission or locking issues.
Corporate environments: Group Policy might restrict junction creation. Talk to your IT department about enabling Developer Mode or granting necessary permissions.
Use --no-bin-links: As a last resort, skip link creation entirely:
npm install --no-bin-linksWSL alternative: If Windows permissions are too restrictive, consider using Windows Subsystem for Linux (WSL) where npm permissions work like on native Linux.