Unable to deploy 11ty site via Netlify due to fsevents platform error

I’m trying to deploy my 11ty site via Netlify using Github for the continuous deployment however I’m unable to due to the following error:

8:12:37 PM: npm ERR! code EBADPLATFORM
8:12:37 PM: npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
8:12:37 PM: npm ERR! notsup Valid OS:    darwin
8:12:37 PM: npm ERR! notsup Valid Arch:  undefined
8:12:37 PM: npm ERR! notsup Actual OS:   linux
8:12:37 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
8:12:37 PM: npm ERR! notsup Actual Arch: x64
8:12:37 PM: npm ERR! A complete log of this run can be found in:
8:12:37 PM: npm ERR!     /opt/buildhome/.npm/_logs/2023-01-02T20_12_36_805Z-debug-0.log
8:12:37 PM: Error during NPM install
8:12:37 PM: Build was terminated: Build script returned non-zero exit code: 1
8:12:37 PM: Failing build: Failed to build site
8:12:37 PM: Finished processing build request in 11.045830236s

I’ve tried deleting the package-lock.json file along with the node_modules directory and then re-triggering the deployment but that still throws the same error.

I’ve also added --omit=optional flag to the npm install command but still no luck.

I develop locally on my Mac and from what I can tell the fsevents package is installed via a separate dependancy to do with file watching. I think it’s installed due to the below section of the package-lock.json file (hence why I thought the --omit=optional flag would solve the issue):

"node_modules/chokidar": {
      "version": "3.5.3",
      "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
      "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
      "funding": [
        {
          "type": "individual",
          "url": "https://paulmillr.com/funding/"
        }
      ],
      "dependencies": {
        "anymatch": "~3.1.2",
        "braces": "~3.0.2",
        "glob-parent": "~5.1.2",
        "is-binary-path": "~2.1.0",
        "is-glob": "~4.0.1",
        "normalize-path": "~3.0.0",
        "readdirp": "~3.6.0"
      },
      "engines": {
        "node": ">= 8.10.0"
      },
      "optionalDependencies": {
        "fsevents": "~2.3.2"
      }
    },

Has anyone seen this before and know of a fix?

Thanks in advance!

Hmm, I’ve never seen anyone use the optional dependencies before, not sure how those are supposed to work.

I do think that if you:

  • made it a devDependency
  • and set the NODE_ENV envirionment variable to a value of production

…that it might help work around the problem. It’s not typical to have any mention of fsevents in package.json if you build here - just to clarify, though - do you even use npm on your own machine, vs yarn?