strapi-docker icon indicating copy to clipboard operation
strapi-docker copied to clipboard

error Error: 'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-x64' platform.

Open vlbaluk opened this issue 3 years ago • 8 comments

On MAC OS platform.

 error Error: 'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-x64' platform.
 debug ⛔️ Server wasn't able to start properly.
[2020-12-29T11:56:31.628Z] error Error: 'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-x64' platform.
    at Object.hasVendoredLibvips (/srv/app/node_modules/sharp/lib/libvips.js:62:13)
    at Object.<anonymous> (/srv/app/node_modules/sharp/lib/constructor.js:7:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/srv/app/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
services:
  strapi:
    container_name: strapi
    image: strapi/strapi
    environment:
      - DATABASE_CLIENT=postgres
      - DATABASE_HOST=db
      - DATABASE_PORT=5432
      - DATABASE_NAME=strapi
      - DATABASE_USERNAME=strapi
      - DATABASE_PASSWORD=strapi
    ports:
      - 1337:1337
    volumes:
      - ./backend:/srv/app
    depends_on:
      - postgres_db_1

vlbaluk avatar Dec 29 '20 11:12 vlbaluk

Hi @vlbaluk, From the looks of it the error is coming because you have run npm install outside of the container (on the OSX host) so it install the mac dependency and then you are trying to run the code in the container.

Make sure to run npm or yarn install in the container (will do it automatically if you delete the node_modules folder)

alexandrebodin avatar Dec 30 '20 14:12 alexandrebodin

Hi @vlbaluk were you able to workout your issues ?

alexandrebodin avatar Feb 08 '21 08:02 alexandrebodin

Same problem here, and couldn't solve it either.

rodmirsantana avatar Feb 23 '21 02:02 rodmirsantana

@rodmirsantana - Did you remove the node_modules folder? I had the same problem so did an rm -rf ./node_modules and was able to spin up the container after

dmcdaniel12 avatar Mar 02 '21 20:03 dmcdaniel12

I'm having this problem with Heroku, it just happened suddenly.

@rodmirsantana - Did you remove the node_modules folder? I had the same problem so did an rm -rf ./node_modules and was able to spin up the container after

It didn't work for me.

SalahAdDin avatar Mar 08 '21 19:03 SalahAdDin

Adding node_modules to .dockerignore worked for me.

ahmdrami avatar Mar 27 '21 09:03 ahmdrami

Another cause/solution is to delete your node modules after you have upgraded the package dependencies. For example, yarn upgrade --latest && rm -rf node_modules && docker-compose up works for me.

m-torin avatar Apr 21 '21 16:04 m-torin

Been having the same issue trying to get the GraphQL plugin to work. it doesn't install from the market place and if you install in the terminal then you get the said error.

my work around: $rm -rf node_modules && yarn cache clean (and also delete .cache folder) $yarn install && yarn strapi install graphql if all goes well then: $rm -rf node_modules && yarn cache clean && docker-compose up -d

Muhammad-1990 avatar Jul 07 '21 00:07 Muhammad-1990