strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 445 forks source link

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. #266

Open vlbaluk opened 3 years ago

vlbaluk commented 3 years ago

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
alexandrebodin commented 3 years ago

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 commented 3 years ago

Hi @vlbaluk were you able to workout your issues ?

rodmirsantana commented 3 years ago

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

dmcdaniel12 commented 3 years ago

@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

SalahAdDin commented 3 years ago

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.

ahmdrami commented 3 years ago

Adding node_modules to .dockerignore worked for me.

m-torin commented 3 years ago

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.

Muhammad-1990 commented 3 years ago

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