Reputation: 918
I'm trying to install captcha npm module, which exploits the canvas module.
Unfortunately I have problem to install that module on OSX. I'm getting the following error:
> [email protected] install ....../node_modules/canvas
> node-gyp rebuild
not found: ldconfig
gyp: Call to './util/has_lib.sh jpeg' returned exit status 0. 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/Cellar/node/0.10.21/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.21/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd ...../node_modules/canvas
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
Any idea? Apparently there is ldconfig missing. But no idea how to install it.
I'm using homebrew, and I have the lastest XCode, and command line tools installed.
Upvotes: 3
Views: 1631
Reputation: 239
M1 native does not release binary version of canvas in node15. Therefore, when you install canvas, you will automatically compile from the source code, but if you do not install the corresponding dependency, you will report an error.
Solution
arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg
Upvotes: 0
Reputation: 3
According to my knowledge you need to install Get Xcode 6.1 .
Install Xcode and the Xcode Command Line Tools
Agree to Xcode license in Terminal: sudo xcodebuild -license
Install MacPorts for your version of OS X: OS X 10.10 Yosemite
https://www.macports.org/install.php
Upvotes: -1
Reputation: 918
This is my workaround:
First we need to install cairo:
brew install cairo jpeg
It takes sometime. However now it's time to update PKG_CONFIG_PATH, pointing at the cairo libraries.
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
To compile canvas we need to have node-gyp installed.
npm install node-gyp -g
If the installation still is not working because of missing jpeg lib, you need to run:
npm install canvas
in directory of the project where it's needed and then to stop installation just before the error reporting. Then you need change directory and recompile manually the C++ binding
cd node_modules/canvas/
node-gyp rebuild
after that you should have working canvas module.
Upvotes: 5