0

I am trying to deploy my app to digitalocean with dokku. Even if I have ssh'ed to digitalocean machine and ran a command to install all dependencies as is stated in wiki (sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++), I still receive the following error:

   -----> Building dependencies
          Pruning any extraneous modules
          Installing node modules (package.json)

          > canvas@1.4.0 install /tmp/build/node_modules/canvas
          > node-gyp rebuild

          make: Entering directory `/tmp/build/node_modules/canvas/build'
          SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
          COPY Release/canvas-postbuild.node
          CXX(target) Release/obj.target/canvas/src/Canvas.o
          CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
          CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
          In file included from ../src/CanvasPattern.cc:9:0:
          ../src/Image.h:19:21: fatal error: gif_lib.h: No such file or directory
          #include <gif_lib.h>
          ^
          compilation terminated.
          make: *** [Release/obj.target/canvas/src/CanvasPattern.o] Error 1
          make: Leaving directory `/tmp/build/node_modules/canvas/build'
          gyp ERR! build error
          gyp ERR! stack Error: `make` failed with exit code: 2
          gyp ERR! stack     at ChildProcess.onExit (/tmp/build/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
          gyp ERR! stack     at emitTwo (events.js:87:13)
          gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
          gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
          gyp ERR! System Linux 3.13.0-85-generic
          gyp ERR! command "/tmp/build/.heroku/node/bin/node" "/tmp/build/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
          gyp ERR! cwd /tmp/build/node_modules/canvas
          gyp ERR! node -v v4.4.5
          gyp ERR! node-gyp -v v3.3.1
          gyp ERR! not ok

I have googled a lot, the only solution was to install libgif-dev, but I have already installed it. So any ideas what may be wrong?

Specs: Ubuntu 14.04, dokku 0.6.3, node 4.4.5, npm 2.15.5

kaytrance
  • 2,657
  • 4
  • 30
  • 49
  • Are you actually installing `libgif-dev` in your container? I'm not familiar with dokku, but do you have a Dockerfile or similar? – mscdex Jun 28 '16 at 13:43
  • I am not sure if I.. I just ssh to my droplet and run `apt-get install` with libraries provided. Does it counts as if I am installing it in container as well? – kaytrance Jun 28 '16 at 13:45
  • I think you need to install the relevant packages *inside* the container since that seems to be where `canvas` is actually being compiled (and not in the host OS). I think the [dokku-apt](https://github.com/F4-Group/dokku-apt) plugin may be what you need for this. – mscdex Jun 28 '16 at 14:09
  • great! managed to solve the issue by adding `dokku-apt` plugin – kaytrance Jun 29 '16 at 09:57

1 Answers1

0

The dokku-apt plugin for dokku allows you to install packages (e.g. libgif-dev) inside a dokku container. This plugin should help since you're actually building the canvas node addon inside the container.

mscdex
  • 104,356
  • 15
  • 192
  • 153