saleor: Install on MacOS Apple M1 failed

What I’m trying to achieve

Just want to install on MacOS Monterey 12.1.

Steps to reproduce the problem

  1. git clone https://github.com/saleor/saleor-platform.git --recursive --jobs 3
  2. docker-compose build

What I expected to happen

No error

Screenshots and logs

System information

=> ERROR [4/5] RUN npm install                                                                                                               40.3s
------
 > [4/5] RUN npm install:
#9 37.17
#9 37.17 > phantomjs-prebuilt@2.1.16 install /app/node_modules/phantomjs-prebuilt
#9 37.17 > node install.js
#9 37.17
#9 37.28 PhantomJS not found on PATH
#9 37.28 Unexpected platform or architecture: linux/arm64
#9 37.28 It seems there is no binary available for your platform/architecture
#9 37.28 Try to install PhantomJS globally
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/jest/node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/chokidar/node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@storybook/addon-storyshots/node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/@jest/transform/node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@storybook/addon-docs/node_modules/fsevents):
#9 38.98 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 38.98
#9 39.05 npm ERR! code ELIFECYCLE
#9 39.05 npm ERR! errno 1
#9 39.05 npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
#9 39.05 npm ERR! Exit status 1
#9 39.05 npm ERR!
#9 39.05 npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script.
#9 39.05 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#9 39.13
#9 39.13 npm ERR! A complete log of this run can be found in:
#9 39.13 npm ERR!     /root/.npm/_logs/2022-01-10T19_38_56_371Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 1
ERROR: Service 'storefront' failed to build : Build failed

Saleor version:

  • [ X] dev (current main)
  • 3.0
  • 2.11
  • 2.10

Operating system:

  • Windows
  • Linux
  • MacOS Monterey 12.1 (Apple M1)
  • Other

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

If anyone struggles with this…

I did a fresh clone the repository for the first time today and had the issue described in this thread.

To fix, I entered the react-storefront/ directory and noticed it wasn’t on the main branch. I did git checkout main and then re-ran docker compose build and it worked.

The reason I checked was because this was in the log…

#23 22.49 > husky install
#23 22.49
#23 22.55 fatal: not a git repository (or any of the parent directories): .git

I did exactly as requested but I get a new issue 😦 Screen Shot 2022-02-09 at 7 36 42 PM

@malakbenr

Can you show your docker-compose file? It looks like you did not set platform to “linux/amd64”. Some of the packages (both npm and python) may not have arm compiled versions and this might be the issue.

diff --git a/docker-compose.yml b/docker-compose.yml
index 89156e6..fc2d155 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,6 +2,7 @@ version: "2"

 services:
   api:
+    platform: "linux/amd64"
     ports:
       - 8000:8000
     build:
@@ -30,17 +31,20 @@ services:
       - DASHBOARD_URL=http://localhost:9000/

   storefront:
+    platform: "linux/amd64"
     build:
       context: ./saleor-storefront
       dockerfile: ./Dockerfile.dev
     restart: unless-stopped
     
 (...)

Note that you have to set the platform to at least api, worker, dashboard and storefront services ( I set it for every service though and it works, no additional changes to dockerfiles are required ). Please also note that I am using version 2.11 (pinned commit in saleor-platform repo).

If you have any problems, try to clone the clean repo first, make the changes in docker-compose file and then try to run it. Hope that helps.

The best thing i got to upcome this error is to go to the dockerfile (storefront) and it looks like a version problem so (be sure to edit dockerfile.dev) : FROM node:12.22.9 WORKDIR /app COPY package*.json ./ RUN npm update -g RUN npm install COPY . . ARG API_URI ENV API_URI ${API_URI:-http://localhost:8000/graphql/}

EXPOSE 3000 CMD npm start – --host 0.0.0.0

Then go to saleor dashbord’s dockerfile.dev and do the same changes : FROM node:12.22.9

WORKDIR /app COPY package*.json ./ RUN npm update -g RUN npm install COPY . . ARG APP_MOUNT_URI ARG API_URI ARG STATIC_URL ENV API_URI ${API_URI:-http://localhost:8000/graphql/} ENV APP_MOUNT_URI ${APP_MOUNT_URI:-/dashboard/} ENV STATIC_URL ${STATIC_URL:-/dashboard/}

EXPOSE 9000 CMD npm start – --host 0.0.0.0

Hi guys! Thanks for reporting. I’ve passed the issue to the team. Unfortunately, we’re a bit behind on some other stuff–we have higher priorities at the moment. We’ll try to reproduce the problems with saleor-platform as soon as possible.