The ENOTSUP platform error occurs when a package declares it only works on specific operating systems. Common examples include the 'n' version manager (Linux/macOS only) on Windows. Use platform-appropriate alternatives or WSL on Windows.
This error occurs when you try to install a package that has declared itself incompatible with your operating system. Package maintainers can specify supported platforms in their package.json using the "os" field—and npm enforces these restrictions during installation. A classic example is the "n" Node.js version manager, which specifies `"os": "!win32"` (not Windows) because it relies on Unix shell scripts. When you try to install it on Windows, npm refuses with ENOTSUP. This is npm protecting you from installing software that won't work on your system, rather than letting you discover the incompatibility at runtime.
Look at the error message to see what platform the package wants:
Unsupported platform for [email protected]: wanted {"os":"!win32"} (current: {"os":"win32"})The !win32 means "not Windows". Check the package's npm page or GitHub for platform-specific alternatives.
Many packages have alternatives for different platforms:
| Package | Alternative for Windows |
|---------|------------------------|
| n | nvm-windows or fnm |
| fsevents | Not needed (macOS only) |
| unix-specific CLIs | WSL (Windows Subsystem for Linux) |
For example, instead of n, use nvm-windows:
# Install nvm-windows from https://github.com/coreybutler/nvm-windows
nvm install 20
nvm use 20Windows Subsystem for Linux lets you run Linux tools natively:
# Install WSL (PowerShell as Admin)
wsl --install
# Then in WSL terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20WSL provides a full Linux environment where most npm packages work without modification.
Some packages like fsevents are optional and only needed on specific platforms. Warnings about them are usually safe to ignore:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]These warnings don't prevent installation—they just indicate a platform-specific optimization won't be available.
You can bypass platform checks, but the package likely won't work:
npm install <package> --forceWarning: This installs the package but doesn't make it compatible. Only use this if you know the package will work despite the warning.
If you're getting ENOTSUP in Vagrant with Node.js 18.18+:
1. Move your project out of Vagrant shared folders
2. Or run npm install on the host machine
3. Or downgrade to Node.js 18.17 or earlier
This is a known issue with Node.js socket operations on VirtualBox shared folders.
Package maintainers declare platform support in their package.json:
{
"os": ["darwin", "linux"], // Only macOS and Linux
"os": ["!win32"], // Not Windows
"cpu": ["x64", "arm64"] // Specific architectures
}If you're a package maintainer and want to support more platforms, consider:
- Using cross-platform Node.js APIs instead of platform-specific code
- Providing alternative implementations for different platforms
- Clearly documenting platform requirements
For CI/CD pipelines, ensure your build runners match your deployment target. If you deploy to Linux but build on macOS, platform-specific optional dependencies may differ.
The ENOTSUP error can also occur with socket operations on network-mounted filesystems. If npm commands fail with "operation not supported on socket" errors, try running npm from a local filesystem instead of network drives or mounted volumes.
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