How to fix npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction in npm
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.
Quick fix
Fixes npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction
cd C:\path\to\your\project- Close applications holding file locks
- Enable Windows Developer Mode
- Run as Administrator
- Clear npm cache and reinstall
cd C:\path\to\your\projectnpm ERR! code EPERMnpm ERR! EPERM: operation not permitted, junction
What this error means
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.
Typical symptoms
- npm install fails with 'EPERM: operation not permitted, junction'
- Error occurs on Windows only
- npm link or workspace operations fail
- Works when running as Administrator
Common causes
- Running npm without Administrator privileges
- Windows Developer Mode not enabled
- Antivirus or Windows Defender blocking file operations
- Another process (IDE, dev server) has files locked
- node_modules folder marked as read-only
How to fix "npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction"
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.
Advanced notes
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.
Frequently asked questions
- What does "npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction" mean?
- 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.
- How do I fix "npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction"?
- 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.
- What causes "npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction"?
- Running npm without Administrator privileges Windows Developer Mode not enabled Antivirus or Windows Defender blocking file operations
- Is the "npm ERR! code EPERM npm ERR! EPERM: operation not permitted, junction" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚npm Official Documentation
- 📖Docs: npm link on Windows(Official Docs)
- 🐙GitHub: npm Windows issues(GitHub)
- 💬SO: npm on Windows(Stack Overflow)