How to fix npm ERR! code ENOTSUP npm ERR! notsup Unsupported platform for package: wanted {"os":"linux"} (current: {"os":"win32"}) in npm
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.
Quick fix
Fixes ENOTSUP
Unsupported platform for n@9.0.0: wanted {"os":"!win32"} (current: {"os":"win32"})- Check the package's platform requirements
- Use platform-appropriate alternatives
- Use WSL for Unix-only packages
- Handle optional dependencies gracefully
Unsupported platform for n@9.0.0: wanted {"os":"!win32"} (current: {"os":"win32"})npm ERR! code ENOTSUPnpm ERR! notsup Unsupported platform for package: wanted {"os":"linux"} (current: {"os":"win32"})
What this error means
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.
Typical symptoms
- npm install fails with 'Unsupported platform' message
- Error shows wanted OS vs current OS mismatch
- Package explicitly lists !win32, !darwin, or !linux
- Installing fsevents on Linux shows warnings (non-blocking)
- All npm commands fail with ENOTSUP after Node.js upgrade
- Package worked before but fails after system changes
Common causes
- Package explicitly declares incompatible OS in package.json
- Trying to install Unix-specific tools on Windows (e.g., 'n' version manager)
- Installing macOS-specific packages like fsevents on Linux
- Copying package-lock.json from a different OS
- Vagrant shared folders causing socket operation errors
- Antivirus software interfering with npm operations
How to fix "npm ERR! code ENOTSUP npm ERR! notsup Unsupported platform for package: wanted {"os":"linux"} (current: {"os":"win32"})"
Look at the error message to see what platform the package wants:
Unsupported platform for n@9.0.0: 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: fsevents@2.3.2These 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.
Advanced notes
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.
Frequently asked questions
- What does "ENOTSUP" mean?
- This error occurs when you try to install a package that has declared itself incompatible with your operating system. json using the "os" field—and npm enforces these restrictions during installation. win32" (not Windows) because it relies on Unix shell scripts.
- How do I fix "ENOTSUP"?
- 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.
- What causes "ENOTSUP"?
- Package explicitly declares incompatible OS in package.json Trying to install Unix-specific tools on Windows (e.g., 'n' version manager) Installing macOS-specific packages like fsevents on Linux
- Is the "ENOTSUP" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.