The EBADPLATFORM error occurs when a package doesn't support your operating system or CPU architecture. This is common with native binaries that aren't built for all platforms.
Packages can specify which operating systems (os) and CPU architectures (cpu) they support. EBADPLATFORM means your current platform isn't in the supported list. This commonly occurs with packages containing native binaries (compiled C/C++ code), platform-specific tools, or packages intentionally limited to certain platforms.
View package platform support:
npm view package-name os
npm view package-name cpu
# Your platform
node -p "process.platform + ' ' + process.arch"Make the dependency optional:
{
"optionalDependencies": {
"platform-specific-pkg": "^1.0.0"
}
}npm won't fail if optional deps can't install.
Skip native compilation:
npm install --ignore-scriptsNote: Package may not work without its native parts.
Search for alternatives:
# Search for similar functionality
npm search "functionality you need"
# Check if pure JS version existsHandle platform differences:
{
"scripts": {
"postinstall": "node scripts/platform-setup.js"
},
"optionalDependencies": {
"win-specific": "^1.0.0",
"mac-specific": "^1.0.0"
}
}On Apple Silicon:
# Check architecture
uname -m
# Run terminal in Rosetta
arch -x86_64 npm installFor cross-platform development, consider abstracting platform-specific code behind a common interface. Docker can provide consistent Linux environment regardless of host. Some native packages offer prebuilt binaries for multiple platforms - check documentation. In monorepos, platform-specific packages may need workspace configuration.
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