Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npm says 'Unsupported platform for fsevents' on Windows or Linux

ErrorUnsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Short answer

fsevents only works on macOS. Build tools list it as an optional dependency, and npm is allowed to skip an optional package that cannot install, so on Windows or Linux the line is a notice, not the failure. If the install stops, the error is elsewhere in the output. If you list fsevents yourself, move it to optionalDependencies.

  • Applies to npm 10, Node.js 22, Windows 11, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out which package pulls fsevents in, and whether the install finished. The exit code tells you if the warning mattered.

    npm ls fsevents
    npm install; echo "exit code: $?"
  2. 2Match what you see, then jump to its fix

    1. 1npm ls fsevents shows it under a watcher package, and npm install exits with code 0A dependency lists fsevents as optional, so the line is only a noticeFix
    2. 2npm ls fsevents shows it directly under your project name, and package.json lists itfsevents is in your own dependencies or devDependenciesFix
    3. 3You maintain a package with native macOS code and see the same text from your own codeYour own package should only be installed on some operating systemsFix

What does the error look like?

  • Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Cause 1 of 3

A dependency lists fsevents as optional, so the line is only a notice

1Check

Optional dependencies that cannot be found or fail to install do not stop the install. The notice itself says fsevents wants the darwin (macOS) platform and your host is something else.

npm ls fsevents
node -p "process.platform"

2Fix

Nothing to fix. npm continues without the package. If the line bothers you, skip optional packages.

npm install --omit=optional

3Verify

The install ends with exit code 0 and your dev server or build starts.

npm install; echo "exit code: $?"

Confirmed by docs.npmjs.com

Did this fix it?

Cause 2 of 3

fsevents is in your own dependencies or devDependencies

1Check

Only optionalDependencies get the skip-on-failure treatment. A copy you added by hand to dependencies or devDependencies is treated as a normal dependency.

grep -n "fsevents" package.json

2Fix

Remove it from dependencies and add it again as an optional dependency, or delete it if no code of yours imports it.

npm uninstall fsevents
npm install --save-optional fsevents

3Verify

package.json now shows fsevents under optionalDependencies and the install passes on Windows or Linux.

grep -n -B1 "fsevents" package.json
npm install; echo "exit code: $?"

Confirmed by docs.npmjs.com

Did this fix it?

Cause 3 of 3

Your own package should only be installed on some operating systems

1Check

The os field in package.json restricts a package to the operating systems named in it, taken from process.platform.

grep -n "\"os\"" package.json

2Fix

Declare the supported systems in os, and make any consumer list your package under optionalDependencies, so other systems skip it cleanly.

"os": ["darwin"]

3Verify

On another system the package is skipped and the host project still installs.

npm install; echo "exit code: $?"

Confirmed by docs.npmjs.com

Did this fix it?

How do I stop it coming back?

  • Read the end of the npm output and the exit code before chasing a warning.
  • Never add macOS-only packages to dependencies; use optionalDependencies.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.