Strapi docker deploy error

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

When I’m starting deploy strapi with docker I have next troubleshootings:

107.9 [5/5] Building fresh packages…
144.7 info Visit yarnpkg.com\en\docs\cli\install2 for documentation about this command.
144.7 error /opt/node_modules/@strapi/plugin-upload/node_modules/sharp: Command failed.
144.7 Exit code: 1
144.7 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
144.7 Arguments:
144.7 Directory: /opt/node_modules/@strapi/plugin-upload/node_modules/sharp
144.7 Output:
144.7 sharp: Detected globally-installed libvips v8.15.0
144.7 sharp: Building from source via node-gyp
144.7 gyp info it worked if it ends with ok
144.7 gyp info using node-gyp@10.0.1
144.7 gyp info using node@18.19.0 | linux | x64
144.7 gyp info find Python using Python version 3.11.6 found at “/usr/bin/python3”
144.7
144.7 gyp http GET
144.7 (node:179) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
144.7 (Use node --trace-warnings ... to show where the warning was created)
144.7 gyp http 200
144.7 gyp http GET
144.7 gyp http 200
144.7 gyp info spawn /usr/bin/python3
144.7 gyp info spawn args [
144.7 gyp info spawn args ‘/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py’,
144.7 gyp info spawn args ‘binding.gyp’,
144.7 gyp info spawn args ‘-f’,
144.7 gyp info spawn args ‘make’,
144.7 gyp info spawn args ‘-I’,
144.7 gyp info spawn args ‘/opt/node_modules/strapi/plugin-upload/node_modules/sharp/build/config.gypi’,
144.7 gyp info spawn args ‘-I’,
144.7 gyp info spawn args ‘/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi’,
144.7 gyp info spawn args ‘-I’,
144.7 gyp info spawn args ‘/root/.cache/node-gyp/18.19.0/include/node/common.gypi’,
144.7 gyp info spawn args ‘-Dlibrary=shared_library’,
144.7 gyp info spawn args ‘-Dvisibility=default’,
144.7 gyp info spawn args ‘-Dnode_root_dir=/root/.cache/node-gyp/18.19.0’,
144.7 gyp info spawn args ‘-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp’,
144.7 gyp info spawn args ‘-Dnode_lib_file=/root/.cache/node-gyp/18.19.0/<(target_arch)/node.lib’,
144.7 gyp info spawn args ‘-Dmodule_root_dir=/opt/node_modules/strapi/plugin-upload/node_modules/sharp’,
144.7 gyp info spawn args ‘-Dnode_engine=v8’,
144.7 gyp info spawn args ‘–depth=.’,
144.7 gyp info spawn args ‘–no-parallel’,
144.7 gyp info spawn args ‘–generator-output’,
144.7 gyp info spawn args ‘build’,
144.7 gyp info spawn args ‘-Goutput_dir=.’
144.7 gyp info spawn args ]
144.7 gyp info spawn make
144.7 gyp info spawn args [ ‘BUILDTYPE=Release’, ‘-C’, ‘build’ ]
144.7 make: Entering directory ‘/opt/node_modules/strapi/plugin-upload/node_modules/sharp/build’
144.7 CC(target) Release/obj.target/nothing/…/…/…/…/node-addon-api/nothing.o
144.7 rm -f Release/obj.target/…/…/…/…/node-addon-api/nothing.a Release/obj.target/…/…/…/…/node-addon-api/nothing.a.ar-file-list; mkdir -p dirname Release/obj.target/../../../../node-addon-api/nothing.a
144.7 ar crs Release/obj.target/…/…/…/…/node-addon-api/nothing.a Release/obj.target/…/…/…/…/node-addon-api/nothing.a.ar-file-list
144.7 COPY Release/nothing.a
144.7 TOUCH Release/obj.target/libvips-cpp.stamp
144.7 CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/common.o
144.7 CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/metadata.o
144.7 CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/stats.o
144.7 CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/operations.o
144.7 CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/pipeline.o
144.7 …/src/pipeline.cc: In member function ‘virtual void PipelineWorker::OnOK()’:
defined
144.7 1230 | struct STAT64_STRUCT st;
144.7 | ^~
144.7 …/src/pipeline.cc:1231:55: error: invalid use of incomplete type ‘struct PipelineWorker::OnOK()::stat64’
144.7 1231 | if (STAT64_FUNCTION(baton->fileOut.data(), &st) == 0) {
144.7 | ^
144.7 …/src/pipeline.cc:33:23: note: forward declaration of ‘struct PipelineWorker::OnOK()::stat64’
144.7 33 | #define STAT64_STRUCT stat64
144.7 | ^~~~~~
144.7 …/src/pipeline.cc:1230:16: note: in expansion of macro ‘STAT64_STRUCT’
144.7 1230 | struct STAT64_STRUCT st;
144.7 | ^~~~~~~~~~~~~
144.7 make: *** [sharp-linuxmusl-x64.target.mk:167: Release/obj.target/sharp-linuxmusl-x64/src/pipeline.o] Error 1
144.7 make: Leaving directory ‘/Preformatted textopt/node_modules/strapi/plugin-upload/node_modules/sharp/build’
144.7 gyp ERR! build error
144.7 gyp ERR! stack Error: make failed with exit code: 2
144.7 gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
144.7 gyp ERR! System Linux 5.15.133.1-microsoft-standard-WSL2
144.7 gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
144.7 gyp ERR! cwd /opt/node_modules/strapi/plugin-upload/node_modules/sharp
144.7 gyp ERR! node -v v18.19.0
144.7 gyp ERR! node-gyp -v v10.0.1
144.7 gyp ERR! not ok

failed to solve: process “/bin/sh -c yarn config set network-timeout 600000 -g && NODE_TLS_REJECT_UNAUTHORIZED=0 yarn install” did not complete successfully: exit code: 1

deleting yarn/node_modules doesn’t help

I’m having the same problem. Strapi stoped to build on docker. anyone else?

Could you try using FROM node:18-alpine3.18 as the image?

1 Like

I should have Googled earlier, rather than spending an hour to try building an older version libvips…