Automattic / Automattic/node-canvas

Installation failed: Package zlib was not found in the pkg-config search path

Open
#1,491 5 comments 0 reactions 0 assignees View on GitHub
Installation help
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

I'm trying to install canvas on macOS Mojave 10.14.5. I executed `brew install pkg-config cairo pango libpng jpeg giflib librsvg` but there is still an error.

## Issue or Feature
When i type `npm i canvas` the following log appears:
```
MACBOOK:project user$ npm i canvas

> canvas@2.6.0 install /Users/user/Desktop/project/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.6.0 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error unable to get local issuer certificate
Package zlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `zlib.pc'
to the PKG_CONFIG_PATH environment variable
Package 'zlib', required by 'libpng', not found
gyp: Call to 'pkg-config libpng --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/user/Desktop/project/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/user/Desktop/project/node_modules/canvas/build/Release" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64" "--python=/usr/bin/python"
gyp ERR! cwd /Users/user/Desktop/project/node_modules/canvas
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: 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 --module=/Users/user/Desktop/project/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/user/Desktop/project/node_modules/canvas/build/Release --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64 --python=/usr/bin/python' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/user/Desktop/project/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/user/Desktop/project/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/user/Desktop/project/node_modules/canvas
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
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 --module=/Users/user/Desktop/project/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/user/Desktop/project/node_modules/canvas/build/Release --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64 --python=/usr/bin/python' (1)
npm WARN project@0.3.0 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2019-11-14T12_32_18_808Z-debug.log

```

## Your Environment
* Version of node-canvas: 2.6.0
* Environment: npm 6.4.1 with node 10.15.3 on macOS Mojave 10.14.5

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.