Strapi does not run on Mac M1

I had this issue, but I needed node 18 for other npm packages I wanted to use.

Here’s how i got it working on (bit of a hack for M1):

  • Like you say, using node 14 works on Mac M1…so I did that first - I used node 14.17.4 and npm installed on a project running strapi 4.4.3

  • then i copied the sharp folder from node_modules which will be used later

  • next, I switch to node 18.6.0 and upgrade strapi to 4.11.4, and install packages with npm install --legacy-peer-deps (without legacy-peer-deps something was failing)

  • at this point, running the project results in the sharp error

  • for the fix, I replace the sharp folder in node_modules with the one I copied back in the earlier step

  • then I ran npm install --platform=darwin --arch=arm64v8 sharp

  • running that must update the sharp in node_modules but it also puts a new sharp folder inside node_modules/@strapi/plugin-upload, which I then delete!

  • then rebuild and run , and it worked so I can continue using node 18 with mac m1

overall, maybe not all the steps are needed, but I’ve done the above process twice and it worked both times with different projects - i think the issue is the extra sharp that is inside node_modules/@strapi/plugin-upload