Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.16k stars 1.17k forks source link

Cannot read property 'call' of undefined #1294

Closed dcharbonnier closed 5 years ago

dcharbonnier commented 6 years ago
 TypeError: Cannot read property 'call' of undefined

      at setSource (node_modules/canvas/lib/image.js:102:14)
      at Image.set (node_modules/canvas/lib/image.js:68:7)

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Pop!_OS 18.04 LTS
Release:    18.04
Codename:   bionic

# node --version
v10.13.0

# cat node_modules/canvas/package.json|jq -r .version
2.0.1

# npm --version
6.4.1
zbjornson commented 6 years ago

I think this is a duplicate of #1250, but need to figure out how you got to that state (JS/C++ mismatch). There is a prebuild available for v2.0.1, Node 10.13.0 (node module version 64), linux, glibc, x64; so you shouldn't have hit this from routine installation. Did you install from GitHub or npm?

dcharbonnier commented 6 years ago
➜  oo npm --verbose install --save canvas
npm info it worked if it ends with ok
npm verb cli [ '/home/david/n/bin/node',
npm verb cli   '/home/david/n/bin/npm',
npm verb cli   '--verbose',
npm verb cli   'install',
npm verb cli   '--save',
npm verb cli   'canvas' ]
npm info using npm@6.4.1
npm info using node@v10.13.0
npm verb npm-session 01ae91d074d66510
npm http fetch GET 200 https://registry.npmjs.org/canvas 10ms (from cache)
npm timing stage:loadCurrentTree Completed in 118ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
npm http fetch GET 200 https://registry.npmjs.org/nan 4ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/node-pre-gyp 5ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 31ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/npm-packlist 31ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/npmlog 30ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/nopt 31ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/needle 33ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/rc 32ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/tar 32ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/rimraf 85ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/semver 86ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/mkdirp 91ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/minimist 2ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/sax 22ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/debug 28ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/iconv-lite 798ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/ms 28ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/safer-buffer 20ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/osenv 2ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/abbrev 3ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/os-homedir 19ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/os-tmpdir 23ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/ignore-walk 3ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/npm-bundled 3ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/minimatch 21ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/brace-expansion 20ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/balanced-match 23ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/concat-map 44ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/are-we-there-yet 4ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/gauge 5ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/console-control-strings 6ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/set-blocking 21ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/delegates 3ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/readable-stream 24ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/process-nextick-args 28ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/isarray 30ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/string_decoder 31ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/util-deprecate 44ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/inherits 54ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/safe-buffer 53ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/core-util-is 60ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/aproba 10ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/has-unicode 9ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/wide-align 10ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/object-assign 26ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/signal-exit 29ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/string-width 29ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/strip-ansi 31ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/code-point-at 24ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/is-fullwidth-code-point 24ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/number-is-nan 28ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/ansi-regex 18ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/ini 3ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/deep-extend 4ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/strip-json-comments 22ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/glob 21ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/inflight 22ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/once 26ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/path-is-absolute 29ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/fs.realpath 32ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/wrappy 23ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/fs-minipass 4ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/chownr 5ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/minizlib 5ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/yallist 6ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/minipass 7ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 1450ms
npm timing stage:loadIdealTree Completed in 1466ms
npm timing stage:generateActionsToTake Completed in 8ms
npm verb correctMkdir /home/david/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /home/david/.npm/_locks/staging-0eba9bb567d15f39.lock for /home/david/Code/github.com/dcharbonnier/oo/node_modules/.staging
npm timing audit compress Completed in 2ms
npm info audit Submitting payload of 4683bytes
npm timing action:extract Completed in 197ms
npm timing action:finalize Completed in 27ms
npm timing action:refresh-package-json Completed in 81ms
npm info lifecycle abbrev@1.1.1~preinstall: abbrev@1.1.1
npm info lifecycle ansi-regex@2.1.1~preinstall: ansi-regex@2.1.1
npm info lifecycle aproba@1.2.0~preinstall: aproba@1.2.0
npm info lifecycle balanced-match@1.0.0~preinstall: balanced-match@1.0.0
npm info lifecycle chownr@1.1.1~preinstall: chownr@1.1.1
npm info lifecycle code-point-at@1.1.0~preinstall: code-point-at@1.1.0
npm info lifecycle concat-map@0.0.1~preinstall: concat-map@0.0.1
npm info lifecycle brace-expansion@1.1.11~preinstall: brace-expansion@1.1.11
npm info lifecycle console-control-strings@1.1.0~preinstall: console-control-strings@1.1.0
npm info lifecycle core-util-is@1.0.2~preinstall: core-util-is@1.0.2
npm info lifecycle deep-extend@0.6.0~preinstall: deep-extend@0.6.0
npm info lifecycle delegates@1.0.0~preinstall: delegates@1.0.0
npm info lifecycle detect-libc@1.0.3~preinstall: detect-libc@1.0.3
npm info lifecycle fs.realpath@1.0.0~preinstall: fs.realpath@1.0.0
npm info lifecycle has-unicode@2.0.1~preinstall: has-unicode@2.0.1
npm info lifecycle inherits@2.0.3~preinstall: inherits@2.0.3
npm info lifecycle ini@1.3.5~preinstall: ini@1.3.5
npm info lifecycle isarray@1.0.0~preinstall: isarray@1.0.0
npm info lifecycle minimatch@3.0.4~preinstall: minimatch@3.0.4
npm info lifecycle ignore-walk@3.0.1~preinstall: ignore-walk@3.0.1
npm info lifecycle minimist@0.0.8~preinstall: minimist@0.0.8
npm info lifecycle mkdirp@0.5.1~preinstall: mkdirp@0.5.1
npm info lifecycle ms@2.0.0~preinstall: ms@2.0.0
npm info lifecycle debug@2.6.9~preinstall: debug@2.6.9
npm info lifecycle npm-bundled@1.0.5~preinstall: npm-bundled@1.0.5
npm info lifecycle npm-packlist@1.1.12~preinstall: npm-packlist@1.1.12
npm info lifecycle number-is-nan@1.0.1~preinstall: number-is-nan@1.0.1
npm info lifecycle is-fullwidth-code-point@1.0.0~preinstall: is-fullwidth-code-point@1.0.0
npm info lifecycle object-assign@4.1.1~preinstall: object-assign@4.1.1
npm info lifecycle os-homedir@1.0.2~preinstall: os-homedir@1.0.2
npm info lifecycle os-tmpdir@1.0.2~preinstall: os-tmpdir@1.0.2
npm info lifecycle osenv@0.1.5~preinstall: osenv@0.1.5
npm info lifecycle nopt@4.0.1~preinstall: nopt@4.0.1
npm info lifecycle path-is-absolute@1.0.1~preinstall: path-is-absolute@1.0.1
npm info lifecycle process-nextick-args@2.0.0~preinstall: process-nextick-args@2.0.0
npm info lifecycle minimist@1.2.0~preinstall: minimist@1.2.0
npm info lifecycle safe-buffer@5.1.2~preinstall: safe-buffer@5.1.2
npm info lifecycle safer-buffer@2.1.2~preinstall: safer-buffer@2.1.2
npm info lifecycle iconv-lite@0.4.24~preinstall: iconv-lite@0.4.24
npm info lifecycle sax@1.2.4~preinstall: sax@1.2.4
npm info lifecycle needle@2.2.4~preinstall: needle@2.2.4
npm info lifecycle semver@5.6.0~preinstall: semver@5.6.0
npm info lifecycle set-blocking@2.0.0~preinstall: set-blocking@2.0.0
npm info lifecycle signal-exit@3.0.2~preinstall: signal-exit@3.0.2
npm info lifecycle string_decoder@1.1.1~preinstall: string_decoder@1.1.1
npm info lifecycle strip-ansi@3.0.1~preinstall: strip-ansi@3.0.1
npm info lifecycle string-width@1.0.2~preinstall: string-width@1.0.2
npm info lifecycle strip-json-comments@2.0.1~preinstall: strip-json-comments@2.0.1
npm info lifecycle rc@1.2.8~preinstall: rc@1.2.8
npm info lifecycle util-deprecate@1.0.2~preinstall: util-deprecate@1.0.2
npm info lifecycle canvas@2.0.1~preinstall: canvas@2.0.1
npm info lifecycle node-pre-gyp@0.11.0~preinstall: node-pre-gyp@0.11.0
npm info lifecycle nan@2.11.1~preinstall: nan@2.11.1
npm info lifecycle tar@4.4.6~preinstall: tar@4.4.6
npm info lifecycle minizlib@1.1.1~preinstall: minizlib@1.1.1
npm info lifecycle fs-minipass@1.2.5~preinstall: fs-minipass@1.2.5
npm info lifecycle minipass@2.3.5~preinstall: minipass@2.3.5
npm info lifecycle yallist@3.0.2~preinstall: yallist@3.0.2
npm info lifecycle rimraf@2.6.2~preinstall: rimraf@2.6.2
npm info lifecycle glob@7.1.3~preinstall: glob@7.1.3
npm info lifecycle inflight@1.0.6~preinstall: inflight@1.0.6
npm info lifecycle once@1.4.0~preinstall: once@1.4.0
npm info lifecycle wrappy@1.0.2~preinstall: wrappy@1.0.2
npm info lifecycle npmlog@4.1.2~preinstall: npmlog@4.1.2
npm info lifecycle gauge@2.7.4~preinstall: gauge@2.7.4
npm info lifecycle wide-align@1.1.3~preinstall: wide-align@1.1.3
npm info lifecycle are-we-there-yet@1.1.5~preinstall: are-we-there-yet@1.1.5
npm info lifecycle readable-stream@2.3.6~preinstall: readable-stream@2.3.6
npm timing action:preinstall Completed in 10ms
npm info linkStuff abbrev@1.1.1
npm info linkStuff ansi-regex@2.1.1
npm info linkStuff aproba@1.2.0
npm info linkStuff balanced-match@1.0.0
npm info linkStuff chownr@1.1.1
npm info linkStuff code-point-at@1.1.0
npm info linkStuff concat-map@0.0.1
npm info linkStuff brace-expansion@1.1.11
npm info linkStuff console-control-strings@1.1.0
npm info linkStuff core-util-is@1.0.2
npm info linkStuff deep-extend@0.6.0
npm info linkStuff delegates@1.0.0
npm info linkStuff detect-libc@1.0.3
npm verb linkBins [ { 'detect-libc': './bin/detect-libc.js' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff fs.realpath@1.0.0
npm info linkStuff has-unicode@2.0.1
npm info linkStuff inherits@2.0.3
npm info linkStuff ini@1.3.5
npm info linkStuff isarray@1.0.0
npm info linkStuff minimatch@3.0.4
npm info linkStuff ignore-walk@3.0.1
npm info linkStuff minimist@0.0.8
npm info linkStuff mkdirp@0.5.1
npm verb linkBins [ { mkdirp: 'bin/cmd.js' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff ms@2.0.0
npm info linkStuff debug@2.6.9
npm info linkStuff npm-bundled@1.0.5
npm info linkStuff npm-packlist@1.1.12
npm info linkStuff number-is-nan@1.0.1
npm info linkStuff is-fullwidth-code-point@1.0.0
npm info linkStuff object-assign@4.1.1
npm info linkStuff os-homedir@1.0.2
npm info linkStuff os-tmpdir@1.0.2
npm info linkStuff osenv@0.1.5
npm info linkStuff nopt@4.0.1
npm verb linkBins [ { nopt: './bin/nopt.js' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff path-is-absolute@1.0.1
npm info linkStuff process-nextick-args@2.0.0
npm info linkStuff minimist@1.2.0
npm info linkStuff safe-buffer@5.1.2
npm info linkStuff safer-buffer@2.1.2
npm info linkStuff iconv-lite@0.4.24
npm info linkStuff sax@1.2.4
npm info linkStuff needle@2.2.4
npm verb linkBins [ { needle: './bin/needle' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff semver@5.6.0
npm verb linkBins [ { semver: './bin/semver' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff set-blocking@2.0.0
npm info linkStuff signal-exit@3.0.2
npm info linkStuff string_decoder@1.1.1
npm info linkStuff strip-ansi@3.0.1
npm info linkStuff string-width@1.0.2
npm info linkStuff strip-json-comments@2.0.1
npm info linkStuff rc@1.2.8
npm verb linkBins [ { rc: './cli.js' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff util-deprecate@1.0.2
npm info linkStuff readable-stream@2.3.6
npm info linkStuff are-we-there-yet@1.1.5
npm info linkStuff wide-align@1.1.3
npm info linkStuff gauge@2.7.4
npm info linkStuff npmlog@4.1.2
npm info linkStuff wrappy@1.0.2
npm info linkStuff once@1.4.0
npm info linkStuff inflight@1.0.6
npm info linkStuff glob@7.1.3
npm info linkStuff rimraf@2.6.2
npm verb linkBins [ { rimraf: './bin.js' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff yallist@3.0.2
npm info linkStuff minipass@2.3.5
npm info linkStuff fs-minipass@1.2.5
npm info linkStuff minizlib@1.1.1
npm info linkStuff tar@4.4.6
npm info linkStuff nan@2.11.1
npm info linkStuff node-pre-gyp@0.11.0
npm verb linkBins [ { 'node-pre-gyp': './bin/node-pre-gyp' },
npm verb linkBins   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin',
npm verb linkBins   false ]
npm info linkStuff canvas@2.0.1
npm timing action:build Completed in 28ms
npm info lifecycle abbrev@1.1.1~install: abbrev@1.1.1
npm info lifecycle ansi-regex@2.1.1~install: ansi-regex@2.1.1
npm info lifecycle aproba@1.2.0~install: aproba@1.2.0
npm info lifecycle balanced-match@1.0.0~install: balanced-match@1.0.0
npm info lifecycle chownr@1.1.1~install: chownr@1.1.1
npm info lifecycle code-point-at@1.1.0~install: code-point-at@1.1.0
npm info lifecycle concat-map@0.0.1~install: concat-map@0.0.1
npm info lifecycle brace-expansion@1.1.11~install: brace-expansion@1.1.11
npm info lifecycle console-control-strings@1.1.0~install: console-control-strings@1.1.0
npm info lifecycle core-util-is@1.0.2~install: core-util-is@1.0.2
npm info lifecycle deep-extend@0.6.0~install: deep-extend@0.6.0
npm info lifecycle delegates@1.0.0~install: delegates@1.0.0
npm info lifecycle detect-libc@1.0.3~install: detect-libc@1.0.3
npm info lifecycle fs.realpath@1.0.0~install: fs.realpath@1.0.0
npm info lifecycle has-unicode@2.0.1~install: has-unicode@2.0.1
npm info lifecycle inherits@2.0.3~install: inherits@2.0.3
npm info lifecycle ini@1.3.5~install: ini@1.3.5
npm info lifecycle isarray@1.0.0~install: isarray@1.0.0
npm info lifecycle minimatch@3.0.4~install: minimatch@3.0.4
npm info lifecycle ignore-walk@3.0.1~install: ignore-walk@3.0.1
npm info lifecycle minimist@0.0.8~install: minimist@0.0.8
npm info lifecycle mkdirp@0.5.1~install: mkdirp@0.5.1
npm info lifecycle ms@2.0.0~install: ms@2.0.0
npm info lifecycle debug@2.6.9~install: debug@2.6.9
npm info lifecycle npm-bundled@1.0.5~install: npm-bundled@1.0.5
npm info lifecycle npm-packlist@1.1.12~install: npm-packlist@1.1.12
npm info lifecycle number-is-nan@1.0.1~install: number-is-nan@1.0.1
npm info lifecycle is-fullwidth-code-point@1.0.0~install: is-fullwidth-code-point@1.0.0
npm info lifecycle object-assign@4.1.1~install: object-assign@4.1.1
npm info lifecycle os-homedir@1.0.2~install: os-homedir@1.0.2
npm info lifecycle os-tmpdir@1.0.2~install: os-tmpdir@1.0.2
npm info lifecycle osenv@0.1.5~install: osenv@0.1.5
npm info lifecycle nopt@4.0.1~install: nopt@4.0.1
npm info lifecycle path-is-absolute@1.0.1~install: path-is-absolute@1.0.1
npm info lifecycle process-nextick-args@2.0.0~install: process-nextick-args@2.0.0
npm info lifecycle minimist@1.2.0~install: minimist@1.2.0
npm info lifecycle safe-buffer@5.1.2~install: safe-buffer@5.1.2
npm info lifecycle safer-buffer@2.1.2~install: safer-buffer@2.1.2
npm info lifecycle iconv-lite@0.4.24~install: iconv-lite@0.4.24
npm info lifecycle sax@1.2.4~install: sax@1.2.4
npm info lifecycle needle@2.2.4~install: needle@2.2.4
npm info lifecycle semver@5.6.0~install: semver@5.6.0
npm info lifecycle set-blocking@2.0.0~install: set-blocking@2.0.0
npm info lifecycle signal-exit@3.0.2~install: signal-exit@3.0.2
npm info lifecycle string_decoder@1.1.1~install: string_decoder@1.1.1
npm info lifecycle strip-ansi@3.0.1~install: strip-ansi@3.0.1
npm info lifecycle string-width@1.0.2~install: string-width@1.0.2
npm info lifecycle strip-json-comments@2.0.1~install: strip-json-comments@2.0.1
npm info lifecycle rc@1.2.8~install: rc@1.2.8
npm info lifecycle util-deprecate@1.0.2~install: util-deprecate@1.0.2
npm info lifecycle readable-stream@2.3.6~install: readable-stream@2.3.6
npm info lifecycle are-we-there-yet@1.1.5~install: are-we-there-yet@1.1.5
npm info lifecycle wide-align@1.1.3~install: wide-align@1.1.3
npm info lifecycle gauge@2.7.4~install: gauge@2.7.4
npm info lifecycle npmlog@4.1.2~install: npmlog@4.1.2
npm info lifecycle wrappy@1.0.2~install: wrappy@1.0.2
npm info lifecycle once@1.4.0~install: once@1.4.0
npm info lifecycle inflight@1.0.6~install: inflight@1.0.6
npm info lifecycle glob@7.1.3~install: glob@7.1.3
npm info lifecycle rimraf@2.6.2~install: rimraf@2.6.2
npm info lifecycle yallist@3.0.2~install: yallist@3.0.2
npm info lifecycle minipass@2.3.5~install: minipass@2.3.5
npm info lifecycle fs-minipass@1.2.5~install: fs-minipass@1.2.5
npm info lifecycle minizlib@1.1.1~install: minizlib@1.1.1
npm info lifecycle tar@4.4.6~install: tar@4.4.6
npm info lifecycle nan@2.11.1~install: nan@2.11.1
npm info lifecycle node-pre-gyp@0.11.0~install: node-pre-gyp@0.11.0
npm info lifecycle canvas@2.0.1~install: canvas@2.0.1

> canvas@2.0.1 install /home/david/Code/github.com/dcharbonnier/oo/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/home/david/n/bin/node',
node-pre-gyp verb cli   '/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.11.0
node-pre-gyp info using node@10.13.0 | linux | x64
node-pre-gyp verb command install []
node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp info check checked for "/home/david/Code/github.com/dcharbonnier/oo/node_modules/canvas/build/Release/canvas-prebuilt.node" (not found)
node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.0.1/canvas-prebuilt-v2.0.1-node-v64-linux-glibc-x64.tar.gz
node-pre-gyp http 302 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.0.1/canvas-prebuilt-v2.0.1-node-v64-linux-glibc-x64.tar.gz
node-pre-gyp http 200 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.0.1/canvas-prebuilt-v2.0.1-node-v64-linux-glibc-x64.tar.gz
node-pre-gyp info install unpacking Release/
node-pre-gyp info install unpacking Release/.deps/
node-pre-gyp info install unpacking Release/.deps/Release/
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/backend/
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/backend/PdfBackend.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/backend/Backend.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/backend/ImageBackend.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/backend/SvgBackend.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/Image.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/closure.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/CanvasRenderingContext2d.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/color.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/ImageData.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/toBuffer.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/CanvasGradient.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/Backends.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/Canvas.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/CanvasPattern.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/init.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas/src/register_font.o.d
node-pre-gyp info install unpacking Release/.deps/Release/obj.target/canvas.node.d
node-pre-gyp info install unpacking Release/.deps/Release/canvas.node.d
node-pre-gyp info install unpacking Release/libfontconfig.so.1
node-pre-gyp info install unpacking Release/libjpeg.so.62
node-pre-gyp info install unpacking Release/libgif.so.7
node-pre-gyp info install unpacking Release/libglib-2.0.so.0
node-pre-gyp info install unpacking Release/libgthread-2.0.so.0
node-pre-gyp info install unpacking Release/libpangocairo-1.0.so.0
node-pre-gyp info install unpacking Release/obj.target/
node-pre-gyp info install unpacking Release/obj.target/canvas/
node-pre-gyp info install unpacking Release/obj.target/canvas/src/
node-pre-gyp info install unpacking Release/obj.target/canvas/src/Backends.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/color.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/backend/
node-pre-gyp info install unpacking Release/obj.target/canvas/src/backend/ImageBackend.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/backend/SvgBackend.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/backend/PdfBackend.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/backend/Backend.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/CanvasPattern.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/CanvasRenderingContext2d.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/Image.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/ImageData.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/toBuffer.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/register_font.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/init.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/Canvas.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/closure.o
node-pre-gyp info install unpacking Release/obj.target/canvas/src/CanvasGradient.o
node-pre-gyp info install unpacking Release/obj.target/canvas.node
node-pre-gyp info install unpacking Release/libharfbuzz.so.0
node-pre-gyp info install unpacking Release/libfreetype.so.6
node-pre-gyp info install unpacking Release/canvas.node
node-pre-gyp info install unpacking Release/libpixman-1.so.0
node-pre-gyp info install unpacking Release/libffi.so.6
node-pre-gyp info install unpacking Release/libexpat.so.1
node-pre-gyp info install unpacking Release/libcairo.so.2
node-pre-gyp info install unpacking Release/libstdc++.so.6
node-pre-gyp info install unpacking Release/libpangoft2-1.0.so.0
node-pre-gyp info install unpacking Release/libpng16.so.16
node-pre-gyp info install unpacking Release/libpcre.so.1
node-pre-gyp info install unpacking Release/libpango-1.0.so.0
node-pre-gyp info install unpacking Release/libgobject-2.0.so.0
node-pre-gyp info install unpacking Release/libz.so.1
node-pre-gyp info tarball done parsing tarball
[canvas] Success: "/home/david/Code/github.com/dcharbonnier/oo/node_modules/canvas/build/Release/canvas-prebuilt.node" is installed via remote
node-pre-gyp info ok 
npm verb lifecycle canvas@2.0.1~install: unsafe-perm in lifecycle true
npm verb lifecycle canvas@2.0.1~install: PATH: /home/david/n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/david/Code/github.com/dcharbonnier/oo/node_modules/canvas/node_modules/.bin:/home/david/Code/github.com/dcharbonnier/oo/node_modules/.bin:/home/david/.cargo/bin:/home/david/Code/go/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/home/david/.yarn/bin/:/home/david/bin:/usr/local/go/bin:/home/david/n/bin
npm verb lifecycle canvas@2.0.1~install: CWD: /home/david/Code/github.com/dcharbonnier/oo/node_modules/canvas
npm timing audit submit Completed in 1093ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1093ms
npm timing audit body Completed in 1ms
npm timing action:install Completed in 3509ms
npm info lifecycle abbrev@1.1.1~postinstall: abbrev@1.1.1
npm info lifecycle ansi-regex@2.1.1~postinstall: ansi-regex@2.1.1
npm info lifecycle aproba@1.2.0~postinstall: aproba@1.2.0
npm info lifecycle balanced-match@1.0.0~postinstall: balanced-match@1.0.0
npm info lifecycle chownr@1.1.1~postinstall: chownr@1.1.1
npm info lifecycle code-point-at@1.1.0~postinstall: code-point-at@1.1.0
npm info lifecycle concat-map@0.0.1~postinstall: concat-map@0.0.1
npm info lifecycle brace-expansion@1.1.11~postinstall: brace-expansion@1.1.11
npm info lifecycle console-control-strings@1.1.0~postinstall: console-control-strings@1.1.0
npm info lifecycle core-util-is@1.0.2~postinstall: core-util-is@1.0.2
npm info lifecycle deep-extend@0.6.0~postinstall: deep-extend@0.6.0
npm info lifecycle delegates@1.0.0~postinstall: delegates@1.0.0
npm info lifecycle detect-libc@1.0.3~postinstall: detect-libc@1.0.3
npm info lifecycle fs.realpath@1.0.0~postinstall: fs.realpath@1.0.0
npm info lifecycle has-unicode@2.0.1~postinstall: has-unicode@2.0.1
npm info lifecycle inherits@2.0.3~postinstall: inherits@2.0.3
npm info lifecycle ini@1.3.5~postinstall: ini@1.3.5
npm info lifecycle isarray@1.0.0~postinstall: isarray@1.0.0
npm info lifecycle minimatch@3.0.4~postinstall: minimatch@3.0.4
npm info lifecycle ignore-walk@3.0.1~postinstall: ignore-walk@3.0.1
npm info lifecycle minimist@0.0.8~postinstall: minimist@0.0.8
npm info lifecycle mkdirp@0.5.1~postinstall: mkdirp@0.5.1
npm info lifecycle ms@2.0.0~postinstall: ms@2.0.0
npm info lifecycle debug@2.6.9~postinstall: debug@2.6.9
npm info lifecycle npm-bundled@1.0.5~postinstall: npm-bundled@1.0.5
npm info lifecycle npm-packlist@1.1.12~postinstall: npm-packlist@1.1.12
npm info lifecycle number-is-nan@1.0.1~postinstall: number-is-nan@1.0.1
npm info lifecycle is-fullwidth-code-point@1.0.0~postinstall: is-fullwidth-code-point@1.0.0
npm info lifecycle object-assign@4.1.1~postinstall: object-assign@4.1.1
npm info lifecycle os-homedir@1.0.2~postinstall: os-homedir@1.0.2
npm info lifecycle os-tmpdir@1.0.2~postinstall: os-tmpdir@1.0.2
npm info lifecycle osenv@0.1.5~postinstall: osenv@0.1.5
npm info lifecycle nopt@4.0.1~postinstall: nopt@4.0.1
npm info lifecycle path-is-absolute@1.0.1~postinstall: path-is-absolute@1.0.1
npm info lifecycle process-nextick-args@2.0.0~postinstall: process-nextick-args@2.0.0
npm info lifecycle minimist@1.2.0~postinstall: minimist@1.2.0
npm info lifecycle safe-buffer@5.1.2~postinstall: safe-buffer@5.1.2
npm info lifecycle safer-buffer@2.1.2~postinstall: safer-buffer@2.1.2
npm info lifecycle iconv-lite@0.4.24~postinstall: iconv-lite@0.4.24
npm info lifecycle sax@1.2.4~postinstall: sax@1.2.4
npm info lifecycle needle@2.2.4~postinstall: needle@2.2.4
npm info lifecycle semver@5.6.0~postinstall: semver@5.6.0
npm info lifecycle set-blocking@2.0.0~postinstall: set-blocking@2.0.0
npm info lifecycle signal-exit@3.0.2~postinstall: signal-exit@3.0.2
npm info lifecycle string_decoder@1.1.1~postinstall: string_decoder@1.1.1
npm info lifecycle strip-ansi@3.0.1~postinstall: strip-ansi@3.0.1
npm info lifecycle string-width@1.0.2~postinstall: string-width@1.0.2
npm info lifecycle strip-json-comments@2.0.1~postinstall: strip-json-comments@2.0.1
npm info lifecycle rc@1.2.8~postinstall: rc@1.2.8
npm info lifecycle util-deprecate@1.0.2~postinstall: util-deprecate@1.0.2
npm info lifecycle readable-stream@2.3.6~postinstall: readable-stream@2.3.6
npm info lifecycle are-we-there-yet@1.1.5~postinstall: are-we-there-yet@1.1.5
npm info lifecycle wide-align@1.1.3~postinstall: wide-align@1.1.3
npm info lifecycle gauge@2.7.4~postinstall: gauge@2.7.4
npm info lifecycle npmlog@4.1.2~postinstall: npmlog@4.1.2
npm info lifecycle wrappy@1.0.2~postinstall: wrappy@1.0.2
npm info lifecycle once@1.4.0~postinstall: once@1.4.0
npm info lifecycle inflight@1.0.6~postinstall: inflight@1.0.6
npm info lifecycle glob@7.1.3~postinstall: glob@7.1.3
npm info lifecycle rimraf@2.6.2~postinstall: rimraf@2.6.2
npm info lifecycle yallist@3.0.2~postinstall: yallist@3.0.2
npm info lifecycle minipass@2.3.5~postinstall: minipass@2.3.5
npm info lifecycle fs-minipass@1.2.5~postinstall: fs-minipass@1.2.5
npm info lifecycle minizlib@1.1.1~postinstall: minizlib@1.1.1
npm info lifecycle tar@4.4.6~postinstall: tar@4.4.6
npm info lifecycle nan@2.11.1~postinstall: nan@2.11.1
npm info lifecycle node-pre-gyp@0.11.0~postinstall: node-pre-gyp@0.11.0
npm info lifecycle canvas@2.0.1~postinstall: canvas@2.0.1
npm timing action:postinstall Completed in 9ms
npm verb unlock done using /home/david/.npm/_locks/staging-0eba9bb567d15f39.lock for /home/david/Code/github.com/dcharbonnier/oo/node_modules/.staging
npm timing stage:executeActions Completed in 3897ms
npm timing stage:rollbackFailedOptional Completed in 0ms
npm timing stage:runTopLevelLifecycles Completed in 5509ms
npm verb saving [ { name: 'canvas', spec: '^2.0.1', save: 'dependencies' } ]
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm notice created a lockfile as package-lock.json. You should commit this file.
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN oo@1.0.0 No description
npm WARN oo@1.0.0 No repository field.

+ canvas@2.0.1
added 68 packages from 36 contributors and audited 97 packages in 5.559s
found 0 vulnerabilities

npm verb exit [ 0, true ]
npm timing npm Completed in 5734ms
npm info ok 
dcharbonnier commented 6 years ago

--build-from-source does not help, removing the 2 delete proto.x in Image.js fix the issue

zbjornson commented 6 years ago

On a fresh VM:

zbjornson@instance-4:~/temp$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
zbjornson@instance-4:~/temp$ node --version
v10.13.0
zbjornson@instance-4:~/temp$ npm --version
6.4.1
zbjornson@instance-4:~/temp$ npm install canvas
# ...
+ canvas@2.0.1
added 68 packages from 36 contributors and audited 97 packages in 5.859s
$ node
> const Canvas = require("canvas")
undefined
> var x = new Canvas.Image()
undefined
> x.src = "abc"
'abc'
> 

Based on the error in your OP, I assume the above x.src = "..." will trigger the issue. If --build-from-source isn't fixing it, I almost wonder if canvas is being loaded from somewhere else entirely when you require() it. I don't have many ideas without being able to repro this.

zbjornson commented 5 years ago

Closing for now, but if you find a way to repro, will re-open.

jamescryer commented 5 years ago

I've encountered the same issue on Windows 10, node v10.13.0. As per previous suggestion deleting the two delete proto.x statements fixes the issue. The error occurs when assigning a buffer to image.src. Will investigate and try to provide more details when I can.

LinusU commented 5 years ago

Should be fixed in 2.2.0 🚀