vendure-ecommerce / vendure-docker-compose

A containerized Vendure server and storefront
MIT License
35 stars 37 forks source link

Some problem with sharp on clean cloned repo #5

Open Izayda opened 3 years ago

Izayda commented 3 years ago

Hi !'m trying to dockerized vendure to deploy it on production. Cloned this repo as an example and then tried docker compose up.

Then i can see this error:

izayda@MacBook-Pro-Artem vendure-docker-compose % docker compose up
[+] Building 30.7s (19/29)
 => [vendure-docker-compose_server internal] load build definition from Dockerfile                                                                                                                     0.0s
 => => transferring dockerfile: 280B                                                                                                                                                                   0.0s
 => [vendure-docker-compose_worker internal] load build definition from Dockerfile                                                                                                                     0.0s
 => => transferring dockerfile: 280B                                                                                                                                                                   0.0s
 => [vendure-docker-compose_storefront internal] load build definition from Dockerfile-storefront                                                                                                      0.0s
 => => transferring dockerfile: 507B                                                                                                                                                                   0.0s
 => [vendure-docker-compose_server internal] load .dockerignore                                                                                                                                        0.0s
 => => transferring context: 287B                                                                                                                                                                      0.0s
 => [vendure-docker-compose_worker internal] load .dockerignore                                                                                                                                        0.0s
 => => transferring context: 287B                                                                                                                                                                      0.0s
 => [vendure-docker-compose_storefront internal] load .dockerignore                                                                                                                                    0.0s
 => => transferring context: 287B                                                                                                                                                                      0.0s
 => [vendure-docker-compose_worker internal] load metadata for docker.io/library/node:14                                                                                                               1.3s
 => [vendure-docker-compose_worker 1/8] FROM docker.io/library/node:14@sha256:d8f90b676efb1260957a4170a9a0843fc003b673ae164f22df07eaee9bbc6223                                                         0.0s
 => [vendure-docker-compose_server internal] load build context                                                                                                                                        0.0s
 => => transferring context: 250.48kB                                                                                                                                                                  0.0s
 => [vendure-docker-compose_worker internal] load build context                                                                                                                                        0.1s
 => => transferring context: 250.48kB                                                                                                                                                                  0.0s
 => CACHED [vendure-docker-compose_storefront 2/8] WORKDIR /usr/src/app                                                                                                                                0.0s
 => [vendure-docker-compose_storefront 3/8] RUN echo 0.1.25                                                                                                                                            0.3s
 => [vendure-docker-compose_server 3/8] COPY package.json ./                                                                                                                                           0.0s
 => [vendure-docker-compose_server 4/8] COPY yarn.lock ./                                                                                                                                              0.0s
 => ERROR [vendure-docker-compose_server 5/8] RUN yarn                                                                                                                                                26.7s
 => [vendure-docker-compose_storefront 4/8] RUN curl "https://github.com/vendure-ecommerce/storefront/archive/v0.1.25.zip" -L -o storefront.zip                                                        1.9s
 => [vendure-docker-compose_storefront 5/8] RUN unzip storefront.zip                                                                                                                                   0.2s
 => [vendure-docker-compose_storefront 6/8] RUN cp -a "storefront-0.1.25/." .                                                                                                                          0.2s
 => CANCELED [vendure-docker-compose_storefront 7/8] RUN yarn                                                                                                                                         26.5s
------
 > [vendure-docker-compose_server 5/8] RUN yarn:
#26 0.312 yarn install v1.22.5
#26 0.351 [1/4] Resolving packages...
#26 0.504 [2/4] Fetching packages...
#26 16.40 info fsevents@2.3.2: The platform "linux" is incompatible with this module.
#26 16.40 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
#26 16.40 info fsevents@2.1.3: The platform "linux" is incompatible with this module.
#26 16.40 info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
#26 16.40 [3/4] Linking dependencies...
#26 16.40 warning "@vendure/core > graphql-iso-date@3.6.1" has incorrect peer dependency "graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
#26 16.41 warning "@vendure/core > @nestjs/graphql > @nestjs/mapped-types@0.3.0" has unmet peer dependency "class-transformer@^0.2.0 || ^0.3.0".
#26 16.41 warning "@vendure/core > @nestjs/graphql > @nestjs/mapped-types@0.3.0" has unmet peer dependency "class-validator@^0.11.1 || ^0.12.0 || ^0.13.0".
#26 16.41 warning "@vendure/core > apollo-server-express > graphql-subscriptions@1.1.0" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 || ^14.0.0".
#26 16.41 warning "@vendure/core > @nestjs/graphql > apollo-server-core > graphql-upload@8.1.0" has incorrect peer dependency "graphql@0.13.1 - 14".
#26 16.41 warning "@vendure/core > @nestjs/graphql > @apollo/gateway > apollo-graphql@0.4.5" has incorrect peer dependency "graphql@^14.2.1".
#26 21.78 [4/4] Building fresh packages...
#26 23.81 error /usr/src/app/node_modules/sharp: Command failed.
#26 23.81 Exit code: 1
#26 23.81 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
#26 23.81 Arguments:
#26 23.81 Directory: /usr/src/app/node_modules/sharp
#26 23.81 Output:
#26 23.81 sharp: Use with glibc 2.24 requires manual installation of libvips >= 8.10.6
#26 23.81 sharp: Attempting to build from source via node-gyp but this may fail due to the above error
#26 23.81 sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
#26 23.81 gyp info it worked if it ends with ok
#26 23.81 gyp info using node-gyp@5.1.0
#26 23.81 gyp info using node@14.17.1 | linux | arm64
#26 23.81 gyp info find Python using Python version 2.7.13 found at "/usr/bin/python"
#26 23.81 gyp http GET https://nodejs.org/download/release/v14.17.1/node-v14.17.1-headers.tar.gz
#26 23.81 gyp http 200 https://nodejs.org/download/release/v14.17.1/node-v14.17.1-headers.tar.gz
#26 23.81 gyp http GET https://nodejs.org/download/release/v14.17.1/SHASUMS256.txt
#26 23.81 gyp http 200 https://nodejs.org/download/release/v14.17.1/SHASUMS256.txt
#26 23.81 gyp info spawn /usr/bin/python
#26 23.81 gyp info spawn args [
#26 23.81 gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#26 23.81 gyp info spawn args   'binding.gyp',
#26 23.81 gyp info spawn args   '-f',
#26 23.81 gyp info spawn args   'make',
#26 23.81 gyp info spawn args   '-I',
#26 23.81 gyp info spawn args   '/usr/src/app/node_modules/sharp/build/config.gypi',
#26 23.81 gyp info spawn args   '-I',
#26 23.81 gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#26 23.81 gyp info spawn args   '-I',
#26 23.81 gyp info spawn args   '/root/.cache/node-gyp/14.17.1/include/node/common.gypi',
#26 23.81 gyp info spawn args   '-Dlibrary=shared_library',
#26 23.81 gyp info spawn args   '-Dvisibility=default',
#26 23.81 gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/14.17.1',
#26 23.81 gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#26 23.81 gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/14.17.1/<(target_arch)/node.lib',
#26 23.81 gyp info spawn args   '-Dmodule_root_dir=/usr/src/app/node_modules/sharp',
#26 23.81 gyp info spawn args   '-Dnode_engine=v8',
#26 23.81 gyp info spawn args   '--depth=.',
#26 23.81 gyp info spawn args   '--no-parallel',
#26 23.81 gyp info spawn args   '--generator-output',
#26 23.81 gyp info spawn args   'build',
#26 23.81 gyp info spawn args   '-Goutput_dir=.'
#26 23.81 gyp info spawn args ]
#26 23.81 gyp info spawn make
#26 23.81 gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#26 23.81 make: Entering directory '/usr/src/app/node_modules/sharp/build'
#26 23.81   TOUCH Release/obj.target/libvips-cpp.stamp
#26 23.81   CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
#26 23.81   AR(target) Release/obj.target/node_modules/node-addon-api/nothing.a
#26 23.81   COPY Release/nothing.a
#26 23.81   CXX(target) Release/obj.target/sharp/src/common.o
#26 23.81 ../src/common.cc:24:22: fatal error: vips/vips8: No such file or directory
#26 23.81  #include <vips/vips8>
#26 23.81                       ^
#26 23.81 compilation terminated.
#26 23.81 sharp.target.mk:137: recipe for target 'Release/obj.target/sharp/src/common.o' failed
#26 23.81 make: Leaving directory '/usr/src/app/node_modules/sharp/build'
#26 23.81 make: *** [Release/obj.target/sharp/src/common.o] Error 1
#26 23.81 gyp ERR! build error
#26 23.81 gyp ERR! stack Error: `make` failed with exit code: 2
#26 23.81 gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
#26 23.81 gyp ERR! stack     at ChildProcess.emit (events.js:375:28)
#26 23.81 gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
#26 23.81 gyp ERR! System Linux 5.10.25-linuxkit
#26 23.81 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#26 23.81 gyp ERR! cwd /usr/src/app/node_modules/sharp
#26 23.81 gyp ERR! node -v v14.17.1
#26 23.81 gyp ERR! node-gyp -v v5.1.0
#26 23.81 gyp ERR! not ok
#26 23.81 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c yarn]: exit code: 1
Izayda commented 3 years ago

As i can see, this problem is related to https://github.com/lovell/sharp/issues/2482 and to https://github.com/lovell/sharp/issues/2460

lucasvieceli commented 2 years ago

change the docker file to

FROM node:14.18.2-bullseye-slim

solved for me

michaelbromley commented 2 years ago

Is this still an issue if you delete the yarn.lock file and allow it to use the latest version of Vendure (1.4.6 currently)? Newer versions are using up-to-date Sharp versions which seem to have fixed the issue?

lucasvieceli commented 2 years ago

https://github.com/vendure-ecommerce/vendure-docker-compose/pull/9

@michaelbromley

made a pull request with the fix