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 notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm