Heroku deploy error canvas and gif_lib.h

给你一囗甜甜゛ 提交于 2019-12-13 16:22:29

问题


I'm trying to deploy in Heroku and I get the following build log:

-----> Node.js app detected
-----> Creating runtime environment
       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version (latest stable) via semver.io...
       Downloading and installing node 5.11.1...
       Using default npm version: 3.8.6
-----> Restoring cache
       Skipping cache restore (new runtime signature)
-----> Building dependencies
       Installing node modules (package.json)

       > canvas@1.6.0 install /tmp/build_dea09358fecbaab814f27f093c94d85b/node_modules/canvas
       > node-gyp rebuild
       make: Entering directory `/tmp/build_dea09358fecbaab814f27f093c94d85b/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_dea09358fecbaab814f27f093c94d85b/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_dea09358fecbaab814f27f093c94d85b/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
       gyp ERR! stack     at emitTwo (events.js:100:13)
       gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
       gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
       gyp ERR! System Linux 3.13.0-95-generic
       gyp ERR! command "/tmp/build_dea09358fecbaab814f27f093c94d85b/.heroku/node/bin/node" "/tmp/build_dea09358fecbaab814f27f093c94d85b/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
       gyp ERR! cwd /tmp/build_dea09358fecbaab814f27f093c94d85b/node_modules/canvas
       gyp ERR! node -v v5.11.1
       gyp ERR! node-gyp -v v3.3.1
       gyp ERR! not ok
       Arcolor@0.0.0 /tmp/build_dea09358fecbaab814f27f093c94d85b
       ├─┬ body-parser@1.15.2
       │ ├── bytes@2.4.0
       │ ├── content-type@1.0.2
       │ ├── depd@1.1.0
       │ ├─┬ http-errors@1.5.0
       │ │ ├── inherits@2.0.1
       │ │ ├── setprototypeof@1.0.1
       │ │ └── statuses@1.3.0
       │ ├── iconv-lite@0.4.13
       │ ├─┬ on-finished@2.3.0
       │ │ └── ee-first@1.1.1
       │ ├── qs@6.2.0
       │ ├─┬ raw-body@2.1.7
       │ │ └── unpipe@1.0.0
       │ └─┬ type-is@1.6.13
       │   ├── media-typer@0.3.0
       │   └─┬ mime-types@2.1.12
       │     └── mime-db@1.24.0
       ├─┬ cookie-parser@1.4.3
       │ ├── cookie@0.3.1
       │ └── cookie-signature@1.0.6
       ├─┬ debug@2.2.0
       │ └── ms@0.7.1
       ├── ejs@2.4.2
       ├─┬ express@4.13.4
       │ ├─┬ accepts@1.2.13
       │ │ └── negotiator@0.5.3
       │ ├── array-flatten@1.1.1
       │ ├── content-disposition@0.5.1
       │ ├── cookie@0.1.5
       │ ├── escape-html@1.0.3
       │ ├── etag@1.7.0
       │ ├── finalhandler@0.4.1
       │ ├── fresh@0.3.0
       │ ├── merge-descriptors@1.0.1
       │ ├── methods@1.1.2
       │ ├── parseurl@1.3.1
       │ ├── path-to-regexp@0.1.7
       │ ├─┬ proxy-addr@1.0.10
       │ │ ├── forwarded@0.1.0
       │ │ └── ipaddr.js@1.0.5
       │ ├── qs@4.0.0
       │ ├── range-parser@1.0.3
       │ ├─┬ send@0.13.1
       │ │ ├── destroy@1.0.4
       │ │ ├── http-errors@1.3.1
       │ │ ├── mime@1.3.4
       │ │ └── statuses@1.2.1
       │ ├─┬ serve-static@1.10.3
       │ │ └─┬ send@0.13.2
       │ │   ├── http-errors@1.3.1
       │ │   └── statuses@1.2.1
       │ ├── utils-merge@1.0.0
       │ └── vary@1.0.1
       ├─┬ favicon@0.0.2
       │ └─┬ request@2.75.0
       │   ├── aws-sign2@0.6.0
       │   ├── aws4@1.5.0
       │   ├─┬ bl@1.1.2
       │   │ └── readable-stream@2.0.6
       │   ├── caseless@0.11.0
       │   ├─┬ combined-stream@1.0.5
       │   │ └── delayed-stream@1.0.0
       │   ├── extend@3.0.0
       │   ├── forever-agent@0.6.1
       │   ├─┬ form-data@2.0.0
       │   │ └── asynckit@0.4.0
       │   ├─┬ har-validator@2.0.6
       │   │ ├─┬ chalk@1.1.3
       │   │ │ ├── ansi-styles@2.2.1
       │   │ │ ├── escape-string-regexp@1.0.5
       │   │ │ ├─┬ has-ansi@2.0.0
       │   │ │ │ └── ansi-regex@2.0.0
       │   │ │ ├── strip-ansi@3.0.1
       │   │ │ └── supports-color@2.0.0
       │   │ ├─┬ commander@2.9.0
       │   │ │ └── graceful-readlink@1.0.1
       │   │ ├─┬ is-my-json-valid@2.15.0
       │   │ │ ├── generate-function@2.0.0
       │   │ │ ├─┬ generate-object-property@1.2.0
       │   │ │ │ └── is-property@1.0.2
       │   │ │ ├── jsonpointer@4.0.0
       │   │ │ └── xtend@4.0.1
       │   │ └─┬ pinkie-promise@2.0.1
       │   │   └── pinkie@2.0.4
       │   ├─┬ hawk@3.1.3
       │   │ ├── boom@2.10.1
       │   │ ├── cryptiles@2.0.5
       │   │ ├── hoek@2.16.3
       │   │ └── sntp@1.0.9
       │   ├─┬ http-signature@1.1.1
       │   │ ├── assert-plus@0.2.0
       │   │ ├─┬ jsprim@1.3.1
       │   │ │ ├── extsprintf@1.0.2
       │   │ │ ├── json-schema@0.2.3
       │   │ │ └── verror@1.3.6
       │   │ └─┬ sshpk@1.10.1
       │   │   ├── asn1@0.2.3
       │   │   ├── assert-plus@1.0.0
       │   │   ├── bcrypt-pbkdf@1.0.0
       │   │   ├─┬ dashdash@1.14.0
       │   │   │ └── assert-plus@1.0.0
       │   │   ├── ecc-jsbn@0.1.1
       │   │   ├─┬ getpass@0.1.6
       │   │   │ └── assert-plus@1.0.0
       │   │   ├── jodid25519@1.0.2
       │   │   ├── jsbn@0.1.0
       │   │   └── tweetnacl@0.14.3
       │   ├── is-typedarray@1.0.0
       │   ├── isstream@0.1.2
       │   ├── json-stringify-safe@5.0.1
       │   ├── node-uuid@1.4.7
       │   ├── oauth-sign@0.8.2
       │   ├── stringstream@0.0.5
       │   ├── tough-cookie@2.3.1
       │   └── tunnel-agent@0.4.3
       ├─┬ materialize-css@0.97.7
       │ ├── hammerjs@2.0.8
       │ ├── jquery@2.2.4
       │ └─┬ node-archiver@0.2.0
       │   ├─┬ fstream@0.1.31
       │   │ ├─┬ graceful-fs@3.0.11
       │   │ │ └── natives@1.1.0
       │   │ ├─┬ mkdirp@0.5.1
       │   │ │ └── minimist@0.0.8
       │   │ └─┬ rimraf@2.5.4
       │   │   └─┬ glob@7.1.1
       │   │     ├── fs.realpath@1.0.0
       │   │     ├─┬ inflight@1.0.6
       │   │     │ └── wrappy@1.0.2
       │   │     ├─┬ minimatch@3.0.3
       │   │     │ └─┬ brace-expansion@1.1.6
       │   │     │   ├── balanced-match@0.4.2
       │   │     │   └── concat-map@0.0.1
       │   │     ├── once@1.4.0
       │   │     └── path-is-absolute@1.0.1
       │   └─┬ tar@0.1.20
       │     └── block-stream@0.0.9
       ├─┬ mongodb@2.2.10
       │ ├── es6-promise@3.2.1
       │ ├─┬ mongodb-core@2.0.12
       │ │ └─┬ require_optional@1.0.0
       │ │   ├── resolve-from@2.0.0
       │ │   └── semver@5.3.0
       │ └─┬ readable-stream@2.1.5
       │   ├── buffer-shims@1.0.0
       │   ├── core-util-is@1.0.2
       │   ├── isarray@1.0.0
       │   ├── process-nextick-args@1.0.7
       │   ├── string_decoder@0.10.31
       │   └── util-deprecate@1.0.2
       ├─┬ mongoose@4.6.4
       │ ├─┬ async@2.0.1
       │ │ └── lodash@4.16.4
       │ ├── bson@0.5.6
       │ ├── hooks-fixed@1.2.0
       │ ├── kareem@1.1.3
       │ ├── mpath@0.2.1
       │ ├── mpromise@0.5.5
       │ ├─┬ mquery@2.0.0
       │ │ ├── bluebird@2.10.2
       │ │ └── sliced@0.0.5
       │ ├── muri@1.1.1
       │ ├── regexp-clone@0.0.1
       │ └── sliced@1.0.1
       ├─┬ morgan@1.7.0
       │ ├── basic-auth@1.0.4
       │ └── on-headers@1.0.1
       ├─┬ nodemailer@0.7.1
       │ ├─┬ aws-sdk@2.0.5
       │ │ ├── aws-sdk-apis@3.1.10
       │ │ ├─┬ xml2js@0.2.6
       │ │ │ └── sax@0.4.2
       │ │ └── xmlbuilder@0.4.2
       │ ├── directmail@0.1.8
       │ ├── he@0.3.6
       │ ├─┬ mailcomposer@0.2.12
       │ │ ├─┬ dkim-signer@0.1.2
       │ │ │ └── punycode@1.2.4
       │ │ ├── follow-redirects@0.0.3
       │ │ ├── mime@1.2.11
       │ │ └─┬ mimelib@0.2.19
       │ │   ├── addressparser@0.3.2
       │ │   └── encoding@0.1.12
       │ ├── public-address@0.1.1
       │ ├─┬ readable-stream@1.1.14
       │ │ └── isarray@0.0.1
       │ └─┬ simplesmtp@0.3.35
       │   ├── rai@0.1.12
       │   └── xoauth2@0.1.8
       └── underscore@1.8.3

       npm ERR! Linux 3.13.0-95-generic

       npm ERR! argv "/tmp/build_dea09358fecbaab814f27f093c94d85b/.heroku/node/bin/node" "/tmp/build_dea09358fecbaab814f27f093c94d85b/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_dea09358fecbaab814f27f093c94d85b/.npmrc"

       npm ERR! node v5.11.1
       npm ERR! npm  v3.8.6
       npm ERR! code ELIFECYCLE
       npm ERR! canvas@1.6.0 install: `node-gyp rebuild`
       npm ERR! Exit status 1
       npm ERR!
       npm ERR! Failed at the canvas@1.6.0 install script 'node-gyp rebuild'.
       npm ERR! Make sure you have the latest version of node.js and npm installed.
       npm ERR! If you do, this is most likely a problem with the canvas package,
       npm ERR! not with npm itself.
       npm ERR! Tell the author that this fails on your system:
       npm ERR!     node-gyp rebuild
       npm ERR! You can get information on how to open an issue for this project with:
       npm ERR!     npm bugs canvas
       npm ERR! Or if that isn't available, you can get their info via:
       npm ERR!     npm owner ls canvas
       npm ERR! There is likely additional logging output above.
       npm ERR! Please include the following file with any support request:
       npm ERR!     /tmp/build_dea09358fecbaab814f27f093c94d85b/npm-debug.log

-----> Build failed
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:  
       - Node version not specified in package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed

I'm not sure I understand the cause of the error or how to solve it. I have tried looking into examples such as: Canvas for Node.js working locally but not on Heroku server but I'm not sure how to solve the issue.


回答1:


Eventually Heroku support managed to help me resolve most of the problem by:

  • verify that canvas@1.6.0 is the version you have installed
  • some info in this link https://github.com/Automattic/node-canvas/wiki/Installation-on-Heroku
  • changing the git commands to :

    $ heroku config:set NODE_MODULES_CACHE=false
    
    $ heroku buildpacks:set https://github.com/mojodna/heroku-buildpack-cairo.git
    

Perhaps a variation or some of this info might be useful to someone in the future.



来源:https://stackoverflow.com/questions/40156101/heroku-deploy-error-canvas-and-gif-lib-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!