简体   繁体   中英

Installation of npm package "node-canvas" fails every time. How do I interpret the error message in my console?

I am trying to install the npm package node-canvas . It does not work. This is (an extract of) the error message that I get in my console.

Could someone please help me to interpret these errors? I already tried re-installing properly node-pre-gyp and node-gyp globally. That worked fine (= without any errors), by the way.

npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/dwehsarg/Development/pdf-test4/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/dwehsarg/Development/pdf-test4/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)

Finally, I was able to solve the problem. It appears that the root cause was that "Cairo" was not properly installed. It did install it with

brew install pkg-config cairo pango libpng jpeg giflib librsvg

But maybe there was a typo or something else did not work properly.

I reinstalled all dependencies of "node-canvas" one by one with "brew". After that, installing "node-canvas" with npm install canvas worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM