This error occurs when npm needs admin privileges for global installs or symlinks on Windows. The fix involves running as administrator or changing npm's global prefix to a user-writable directory.
This error occurs when npm encounters a file system permission issue while trying to install packages, create symlinks, or modify files in your project directories. The EPERM code stands for "Operation Not Permitted" and typically indicates that your current user account lacks the necessary privileges to perform the operation npm is attempting. On Windows specifically, this error commonly occurs during global package installations, workspace setups with symlinks, or when npm needs to write to system-protected directories like Program Files or the global npm prefix folder. The root cause is usually a mismatch between where npm is configured to install global packages and where your user account has write permissions. Creating symlinks for workspaces or linked packages on Windows requires either administrator privileges or special permissions unless developer mode is enabled.
This is the quickest temporary solution for global package installations:
1. Press Windows Key + X and select Terminal (Admin) or Command Prompt (Admin)
2. At the prompt, verify you see "Administrator:" in the title
3. Run your npm command:
npm install -g typescript
npm install -g @angular/cliNote: This works for one-off global installs but isn't a permanent solution. You'll need admin access each time.
Reconfigure npm to use a user-writable directory instead of system-protected folders:
1. Open Command Prompt (regular user, no admin needed)
2. Check your current npm prefix:
npm config get prefix3. Set it to your user's AppData folder:
npm config set prefix "%AppData%\npm"4. Verify the change:
npm config get prefixShould return: C:\Users\YourUsername\AppData\Roaming\npm
5. Add this directory to your system PATH if not already included
6. Close and reopen Command Prompt, then test:
npm install -g typescriptRunning applications can lock files in your project, preventing npm from modifying them:
1. Close your IDE: Exit Visual Studio Code, Visual Studio, WebStorm, or any editor with your project open
2. Close file explorer: Close any Windows Explorer windows showing your project folder
3. Stop development server: Kill any running npm start, npm run dev, or npm test processes
4. Clear npm cache to ensure a fresh install:
npm cache clean --force5. Delete existing node_modules and lock file:
rmdir node_modules /s /q
del package-lock.json6. Retry installation:
npm installIf you're using npm workspaces or npm link, enabling Developer Mode allows non-admin users to create symlinks:
1. Press Windows Key + I to open Settings
2. Go to Privacy & Security → For developers
3. Toggle Developer Mode to ON
4. Click "Yes" in the popup confirmation
5. Windows will install required developer features (restart may be needed)
6. After enabling, retry your workspace or link command:
npm install
npm link ../local-packageFiles marked as read-only can cause EPERM errors:
1. Navigate to your project folder in Windows Explorer
2. Right-click the node_modules folder → Properties
3. Check if "Read-only" is checked
- If yes, uncheck it
- Click "Apply", select "Apply changes to this folder, subfolders and files"
- Click OK
4. Also check your project root folder for read-only status
5. If that doesn't work, try changing ownership:
- Right-click node_modules → Properties → Security tab
- Click "Edit" → select your username → click "Full Control" → Apply
6. Retry npm install:
npm installNode.js and npm on Windows have historically required administrator privileges for creating directory symlinks due to Windows security policy. Modern versions of Windows 10+ (build 17063+) and Windows 11 now support Developer Mode, which allows non-administrators to create symlinks without special privileges.
An alternative approach that some package managers use (like Yarn) is to leverage Windows junctions instead of true symlinks. Junctions function almost identically to directory symlinks but don't require elevated privileges.
If you're managing Node.js on corporate machines without admin rights, consider portable Node.js distributions (zip archives rather than installers) or using a Node version manager like nvm-windows, which installs everything in user-writable directories.
For CI/CD pipelines on Windows (GitHub Actions, Azure DevOps, AppVeyor), workspace issues can be mitigated by either enabling symlink permissions in the build agent configuration or explicitly running the build step with elevated privileges.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error