lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.27k stars 1.3k forks source link

error /home/node/app/node_modules/payload/node_modules/sharp: Command failed #4065

Closed mynickleo closed 7 months ago

mynickleo commented 7 months ago

We have a problem with the build on the deployment, production:

error /home/node/app/node_modules/sharp: Command failed. [18:00:10.726] #10 179.0 Exit code: 1 [18:00:10.732] #10 179.0 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) [18:00:10.739] #10 179.0 Arguments: [18:00:10.744] #10 179.0 Directory: /home/node/app/node_modules/sharp [18:00:10.748] #10 179.0 Output: [18:00:10.750] #10 179.0 sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-linuxmusl-x64.tar.br [18:00:10.753] #10 179.0 sharp: Integrity check passed for linuxmusl-x64 [18:00:10.758] #10 179.0 prebuild-install warn install Request timed out [18:00:10.761] #10 179.0 gyp info it worked if it ends with ok [18:00:10.763] #10 179.0 gyp info using node-gyp@10.0.1 [18:00:10.767] #10 179.0 gyp info using node@20.12.2 | linux | x64 [18:00:10.770] #10 179.0 gyp ERR! find Python [18:00:10.774] #10 179.0 gyp ERR! find Python Python is not set from command line or npm configuration [18:00:10.777] #10 179.0 gyp ERR! find Python Python is not set from environment variable PYTHON [18:00:10.779] #10 179.0 gyp ERR! find Python checking if "python3" can be used [18:00:10.782] #10 179.0 gyp ERR! find Python - executable path is "" [18:00:10.785] #10 179.0 gyp ERR! find Python - "" could not be run [18:00:10.789] #10 179.0 gyp ERR! find Python checking if "python" can be used [18:00:10.792] #10 179.0 gyp ERR! find Python - executable path is "" [18:00:10.794] #10 179.0 gyp ERR! find Python - "" could not be run [18:00:10.798] #10 179.0 gyp ERR! find Python [18:00:10.801] #10 179.0 gyp ERR! find Python ** [18:00:10.806] #10 179.0 gyp ERR! find Python You need to install the latest version of Python. [18:00:10.809] #10 179.0 gyp ERR! find Python Node-gyp should be able to find and use Python. If not, [18:00:10.812] #10 179.0 gyp ERR! find Python you can try one of the following options: [18:00:10.814] #10 179.0 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable" [18:00:10.817] #10 179.0 gyp ERR! find Python (accepted by both node-gyp and npm) [18:00:10.821] #10 179.0 gyp ERR! find Python - Set the environment variable PYTHON [18:00:10.824] #10 179.0 gyp ERR! find Python - Set the npm configuration variable python: [18:00:10.826] #10 179.0 gyp ERR! find Python npm config set python "/path/to/pythonexecutable" [18:00:10.829] #10 179.0 gyp ERR! find Python For more information consult the documentation at: [18:00:10.831] #10 179.0 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation [18:00:10.836] #10 179.0 gyp ERR! find Python ** [18:00:10.838] #10 179.0 gyp ERR! find Python [18:00:10.843] #10 179.0 gyp ERR! configure error [18:00:10.843] #10 179.0 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. [18:00:10.847] #10 179.0 gyp ERR! stack Error: Could not find any Python installation to use [18:00:10.849] #10 179.0 gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:306:11) [18:00:10.854] #10 179.0 gyp ERR! stack at PythonFinder.findPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:164:17) [18:00:10.856] #10 179.0 gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [18:00:10.859] #10 179.0 gyp ERR! stack at async configure (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:23:18) [18:00:10.863] #10 179.0 gyp ERR! stack at async run (/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js:81:18) [18:00:10.866] #10 179.0 gyp ERR! System Linux 5.10.0-18-amd64 [18:00:10.872] #10 179.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" [18:00:10.875] #10 179.0 gyp ERR! cwd /home/node/app/node_modules/sharp [18:00:10.879] #10 179.0 gyp ERR! node -v v20.12.2 [18:00:10.881] #10 179.0 gyp ERR! node-gyp -v v10.0.1 [18:00:10.885] #10 179.0 gyp ERR! not ok [18:00:11.125] #10 ERROR: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 1 [18:00:11.129] #7 [builder 5/5] RUN yarn build [18:00:11.132] #7 sha256:dadeb7a6a9a0e67a4b16b3e4e726856eb98b479b2c50624300673752c8a903fb [18:00:11.266] #7 CANCELED

Our dockerfile: FROM node:20-alpine as base

FROM node:20-alpine as base

FROM base as builder

WORKDIR /home/node/app COPY package*.json ./

COPY . . RUN yarn install RUN yarn build

FROM base as runtime

ENV NODE_ENV=production ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

WORKDIR /home/node/app COPY package*.json ./ COPY yarn.lock ./

RUN yarn install --production COPY --from=builder /home/node/app/dist ./dist COPY --from=builder /home/node/app/build ./build

EXPOSE 3000

CMD ["node", "dist/server.js"] CMD ["node", "dist/server.js"]

lovell commented 7 months ago

Please open a new installation issue and answer all of the questions if you still require help.