On a fresh install docker-compose up is failing. Something went wrong installing the "sharp" module

See original GitHub issue

I’m on macOS 12.6 I’ve got a VM running Ubuntu.

installing latest straps app using npx create-strapi-app. No quick install – using mysql.

Strapi is running fine locally. But problems start using the dockerize tool.

running yarn build running npx dockerize. running docker-compose up:

`docker-compose up --build Building strapi [+] Building 2.9s (13/13) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/node:16-alpine 0.5s => [internal] load build context 2.3s => => transferring context: 4.58MB 2.2s => [1/8] FROM docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => => resolve docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => CACHED [2/8] RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev 0.0s => CACHED [3/8] WORKDIR /opt/ 0.0s => CACHED [4/8] COPY ./package.json ./yarn.lock ./ 0.0s => CACHED [5/8] RUN yarn config set network-timeout 600000 -g && yarn install 0.0s => CACHED [6/8] WORKDIR /opt/app 0.0s => CACHED [7/8] COPY ./ . 0.0s => CACHED [8/8] RUN yarn build 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:a0239d571785e36e3e7e29d4fb7e66499989e8b06a862b146f951f2301088be4 0.0s => => naming to docker.io/library/strapi:latest 0.0s

Use ‘docker scan’ to run Snyk tests against images to find vulnerabilities and learn how to fix them Starting strapiDB … done Recreating strapi … done Attaching to strapiDB, strapi strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Switching to dedicated user ‘mysql’ strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | ‘/var/lib/mysql/mysql.sock’ -> ‘/var/run/mysqld/mysqld.sock’ strapiDB | 2022-09-28T11:11:17.710200Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). strapiDB | 2022-09-28T11:11:17.711503Z 0 [Note] mysqld (mysqld 5.7.39) starting as process 1 … strapiDB | 2022-09-28T11:11:17.714134Z 0 [Note] InnoDB: PUNCH HOLE support available strapiDB | 2022-09-28T11:11:17.714169Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins strapiDB | 2022-09-28T11:11:17.714177Z 0 [Note] InnoDB: Uses event mutexes strapiDB | 2022-09-28T11:11:17.714180Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier strapiDB | 2022-09-28T11:11:17.714183Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12 strapiDB | 2022-09-28T11:11:17.714185Z 0 [Note] InnoDB: Using Linux native AIO strapiDB | 2022-09-28T11:11:17.714361Z 0 [Note] InnoDB: Number of pools: 1 strapiDB | 2022-09-28T11:11:17.714479Z 0 [Note] InnoDB: Using CPU crc32 instructions strapiDB | 2022-09-28T11:11:17.715711Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M strapiDB | 2022-09-28T11:11:17.721314Z 0 [Note] InnoDB: Completed initialization of buffer pool strapiDB | 2022-09-28T11:11:17.723259Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). strapiDB | 2022-09-28T11:11:17.735731Z 0 [Note] InnoDB: Highest supported file format is Barracuda. strapiDB | 2022-09-28T11:11:17.737457Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12139546 strapiDB | 2022-09-28T11:11:17.737516Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.737526Z 0 [Note] InnoDB: Database was not shutdown normally! strapiDB | 2022-09-28T11:11:17.737530Z 0 [Note] InnoDB: Starting crash recovery. strapi | yarn run v1.22.19 strapiDB | 2022-09-28T11:11:17.848065Z 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1” strapiDB | 2022-09-28T11:11:17.848115Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables strapiDB | 2022-09-28T11:11:17.848149Z 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait … strapiDB | 2022-09-28T11:11:17.863636Z 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB. strapiDB | 2022-09-28T11:11:17.864288Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864317Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864789Z 0 [Note] InnoDB: 5.7.39 started; log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.864934Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool strapiDB | 2022-09-28T11:11:17.865121Z 0 [Note] Plugin ‘FEDERATED’ is disabled. strapiDB | 2022-09-28T11:11:17.867506Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220928 11:11:17 strapiDB | 2022-09-28T11:11:17.869538Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. strapiDB | 2022-09-28T11:11:17.869566Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. strapiDB | 2022-09-28T11:11:17.869571Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.869573Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.870132Z 0 [Warning] CA certificate ca.pem is self signed. strapiDB | 2022-09-28T11:11:17.870191Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. strapiDB | 2022-09-28T11:11:17.870419Z 0 [Note] Server hostname (bind-address): ‘*’; port: 3306 strapiDB | 2022-09-28T11:11:17.870474Z 0 [Note] IPv6 is available. strapiDB | 2022-09-28T11:11:17.870486Z 0 [Note] - ‘::’ resolves to ‘::’; strapiDB | 2022-09-28T11:11:17.870515Z 0 [Note] Server socket created on IP: ‘::’. strapiDB | 2022-09-28T11:11:17.872241Z 0 [Warning] Insecure configuration for --pid-file: Location ‘/var/run/mysqld’ in the path is accessible to all OS users. Consider choosing a different directory. strapiDB | 2022-09-28T11:11:17.881144Z 0 [Note] Event Scheduler: Loaded 0 events strapiDB | 2022-09-28T11:11:17.881396Z 0 [Note] mysqld: ready for connections. strapiDB | Version: ‘5.7.39’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 MySQL Community Server (GPL) strapi | $ strapi develop strapi | [2022-09-28 11:11:22.741] debug: ⛔️ Server wasn’t able to start properly. strapi | [2022-09-28 11:11:22.743] error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the “sharp” module strapi | strapi | Cannot find module ‘…/build/Release/sharp-linuxmusl-x64.node’ strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: “npm install --ignore-scripts=false --foreground-scripts --verbose sharp” strapi | - Install for the current linuxmusl-x64 runtime: “npm install --platform=linuxmusl --arch=x64 sharp” strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | Error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the “sharp” module strapi | strapi | Cannot find module ‘…/build/Release/sharp-linuxmusl-x64.node’ strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: “npm install --ignore-scripts=false --foreground-scripts --verbose sharp” strapi | - Install for the current linuxmusl-x64 runtime: “npm install --platform=linuxmusl --arch=x64 sharp” strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | at loadJsFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:20:11) strapi | at loadFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:37:14) strapi | at Object.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/core/loaders/plugins/index.js:95:26) strapi | at async Strapi.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:321:5) strapi | at async Promise.all (index 2) strapi | at async Strapi.register (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:357:5) strapi | at async Strapi.load (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:458:5) strapi | at async Strapi.start (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:200:9) strapi | error Command failed with exit code 1. strapi | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
tomastusercommented, Oct 10, 2022

Adding node_modules to .dockerignore helped, thanks. Would it be possible to mention it in the README? Anyway, thanks!

0reactions
Eventyretcommented, Oct 11, 2022

Adding node_modules to .dockerignore helped, thanks. Would it be possible to mention it in the README? Anyway, thanks!

It should be added automatically but will add a warning 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting `Something went wrong installing the "sharp" module ...
I am trying to set up a Gatsby project on Mac OS Catalina (10.15.1). Once I run gatsby develop I get the following...
Read more >
Error installing Sharp in docker container - npm - Stack Overflow
In my case after trying a lot of different options from scouring the github issues for Sharp, the addition of this line to...
Read more >
docker compose up - Docker Documentation
If the process encounters an error, the exit code for this command is 1 . If the process is interrupted using SIGINT (ctrl...
Read more >
My Docker Setup for Gatsby | Walter Teng
I managed to get a fresh Gatsby site up and running on docker in a Windows machine based on this ... Something went...
Read more >
Something went wrong installing the "sharp" module (fix)
If you get the following or a similar sharp module related error when trying to launch your local Gatsby server: There could be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found