18

I've been trying to deploy my application to vercel for a while now and have been reading through lots of posts here on stackoverflow with the the same/similar fsevents issue. Despite everything I keep getting the same errors posted below.

things I've tried:

  • uninstall node_modules & package-lock.json, then running: npm i -f
  • adding "optionalDependencies": {"fsevents": "^2.3.2"}, then npm i -f
  • installing with no fsevents in package.json
  • ... and many other attempts

Screen shot of what always happens in my deploys

I'm not super familiar with that what/why of the whole fsevents/chokidar packages, but it seems like it's needed for my MacOS after what I've been reading and I'd really appreciate some ideas for resolving this.

enter image description here

current package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint .",
    "lint:fix": "eslint --fix ."
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.{js,jsx,ts,tsx}": [
      "prettier --write",
      "eslint --fix ."
    ]
  },
  "dependencies": {
    "firebase": "^8.2.5",
    "firebase-admin": "^9.4.2",
    "firebase-functions": "^3.13.1",
    "fsevents": "^2.3.2",
    "js-cookies": "^1.0.4",
    "next": "10.0.6",
    "next-pwa": "^5.0.5",
    "nookies": "^2.5.2",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "styled-components": "^5.2.1"
  },
  "optionalDependencies": {
    "fsevents": "^2.3.2"
  },
  "devDependencies": {
    "@types/node": "^14.14.25",
    "@types/react": "^17.0.1",
    "@types/react-redux": "^7.1.16",
    "@types/styled-components": "^5.1.7",
    "babel-eslint": "^9.0.0",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-nextjs": "^1.0.7",
    "eslint-config-prettier": "^4.3.0",
    "eslint-plugin-html": "^5.0.5",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^1.7.0",
    "husky": "^4.3.8",
    "lint-staged": "^10.5.3",
    "prettier": "^1.19.1",
    "redux-devtools-extension": "^2.13.8",
    "typescript": "^4.1.3",
    "webpack": "^5.21.1"
  }
}

kevin
  • 2,707
  • 4
  • 26
  • 58
  • Hey Kevin, just today I've stumbled upon the same problem. Have you made any progress? In my case, when I add fsevents=2.3.2 to optionalDependencies, my AWS codebuild throws an error when trying to install yet an older version of fsevents. I'm feeling played... – Sebastian Feb 09 '21 at 17:01
  • 1
    Hey Kevin, it seems my AWS codebuild container had some old packages cached. I fixed the issue by appending a forcing npm to install all packages from remote with the -f option – Sebastian Feb 09 '21 at 17:08
  • 2
    @Sebastian hello, i think I tried forcing the installation in the past as well and if i remember correctly it didn't work. Though, if it worked for you I may need to re-explore that option. Thanks for the update! :) – kevin Feb 09 '21 at 17:11
  • The same problem for Microsoft Azure, I don't know why the cloud providers uses old runtimes, yet Azure hasn't support NodeJS 15 runtime – SalmanShariati Apr 20 '21 at 10:51
  • Similar: npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! notsup Valid OS: darwin npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: linux npm ERR! notsup Actual Arch: x64... npm i -f doesn't help – smartblonde Dec 03 '21 at 23:13
  • I got the same error deploying a MERN app to render.com. I guess it was a compatibility issue between package-lock.json and package.json. Run npm ci ,after that run npm audit fix. npm ci ensures that you have the exact dependencies and versions listed in the package-lock.json file. That did it for me. – Noud Jul 21 '23 at 10:37

3 Answers3

17

lots of people complaining about this going back years.

sometimes the fix is upgrading to newer npm. (running npm 7.7 and still had it)

often the fix is just :

npm install -f

so forcing it worked just fine here.

josh
  • 438
  • 4
  • 10
2

We had the same problem because at the team we had different os types Linux/MacOS/Windows I manually edited the package-lock.json and added the different os types

"node_modules/fsevents": {
  ...
  "os": [
        "darwin",
        "win32",
        "linux"
      ],
  ...
}

after that, I ran npm install

Ioan Stoianov
  • 105
  • 10
0

If anyone is getting these errors on an old version of Node / npm, the best option is likely to upgrade.

node --version

If (as of 2023) this outputs something less than 16.x you probably need to upgrade.

Install / update node to the latest LTS release: https://nodejs.org/en/download and these errors should be fixed.

Cory
  • 22,772
  • 19
  • 94
  • 91