Unsupported platform for [email protected] installation issue

23.4k views Asked by At

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"
  }
}

3

There are 3 answers

0
josh On

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.

1
Ioan Stoianov On

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

0
Cory On

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.