This warning appears on Linux and Windows because fsevents is a macOS-only file watching library. This is completely safe to ignore—npm correctly skips the dependency, and your application works normally without it.
The "npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents" warning appears during npm install on Linux and Windows systems. fsevents is a native Node.js module that provides high-performance file system event monitoring exclusively for macOS via the FSEvents API. Since the FSEvents API doesn't exist on Linux or Windows, npm correctly skips installing this package on those platforms. This is a **warning, not an error**—your application will function normally without this module, as the package that depends on fsevents (typically file watchers like Chokidar) is designed to gracefully degrade and use alternative mechanisms on non-macOS systems. The warning is npm's way of being verbose about platform-specific dependencies. Optional dependencies are intentionally designed to improve performance in specific environments while allowing the application to work correctly without them.
The warning is purely informational and does not affect your application. npm's behavior is correct—it's simply notifying you that an optional platform-specific dependency was skipped because it's unsupported on your OS.
# Run npm install normally - this is safe to do
npm install
# The warning will appear but installation completes successfully
# Your application works exactly as expectedNo action is required—your application functions identically whether or not you see this warning.
For npm version 7 and later, use the --omit=optional flag to skip optional dependencies entirely during installation:
npm install --omit=optionalOr as an environment-level setting in .npmrc:
echo "omit=optional" >> ~/.npmrcThis prevents npm from even attempting to resolve optional dependencies, eliminating the warning entirely.
If you're using an older version of npm, you can skip optional dependencies using the deprecated --no-optional flag:
npm install --no-optionalNote: This flag is deprecated in newer npm versions—use --omit=optional instead if available.
Newer versions of npm handle optional platform-specific dependencies more gracefully and display less intrusive warnings:
npm install -g npm@latest
# Then run your regular install
npm installNewer npm versions are quieter about expected platform skips.
In your CI/CD configuration or .npmrc file, suppress this specific warning category:
# In .npmrc or CI pipeline setup:
warn-only-once=true
# Or configure npm to emit warnings less verbosely:
npm config set loglevel=warnThis keeps your CI/CD logs cleaner without affecting functionality.
The simplest solution is to accept this warning as expected behavior. Modern development practices recognize that platform-specific optional dependencies skipping is the correct behavior:
# Just run normally and ignore the warning
npm install
# Everything works fine - the warning is just information
npm run devYour application functions identically whether you suppress the warning or not.
fsevents is a native N-API module that wraps macOS's low-level FSEvents API, which monitors file system activity at the kernel level. This gives macOS applications much better performance for file watching compared to polling approaches. On Linux, applications typically use inotify (via libraries like Chokidar), and on Windows, ReadDirectoryChangesW handles file monitoring. These are fundamentally different mechanisms, so the dependency cannot be cross-compiled or emulated—it must be skipped on unsupported platforms.
Optional dependencies (optionalDependencies in package.json) are the correct npm mechanism for this pattern: they allow a package to gracefully work on multiple platforms while using platform-specific optimizations where available. Packages like Chokidar deliberately list fsevents as optional and include fallback logic—the package detects at runtime whether fsevents is available and uses it if present, otherwise falls back to cross-platform alternatives.
Some developers report that deleting node_modules and package-lock.json then running npm install fresh can help if the warning becomes problematic in specific environments, though this is rarely necessary.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
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 EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"