Automattic / Automattic/node-canvas

Unable to install via npm

Open
#1,731 8 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

Hi, I am trying to install canvas on my openbsd VM however it does not install.

kingsy# node -v
v12.16.1
kingsy# npm -v
6.14.11

Command to reproduce

env CXX=/usr/bin/clang++ npm install canvas --build-from-source

Output

> canvas@2.6.1 install /var/www/sites/kingsy.co.uk/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
/bin/sh: grep: not found
gyp: Call to 'node ./util/has_lib.js jpeg' returned exit status 0 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:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System OpenBSD 6.8
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /var/www/sites/kingsy.co.uk/node_modules/canvas
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess. (/var/www/sites/kingsy.co.uk/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:311:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System OpenBSD 6.8
node-pre-gyp ERR! command "node" "/var/www/sites/kingsy.co.uk/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/sites/kingsy.co.uk/node_modules/canvas
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute 'node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/var/www/sites/kingsy.co.uk/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN babel-loader@8.1.0 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN redux-persist@6.0.0 requires a peer of redux@>4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN with-redux@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"openbsd","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/next/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"openbsd","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/webpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"openbsd","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.1 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! /root/.npm/_logs/2021-01-14T00_41_41_375Z-debug.log

From the output it seems I am missing libjpeg however I have executed

doas pkg_add cairo pango png jpeg giflib

And can confirm they are installed, I can also see the libs via

kingsy# ls -la /usr/local/lib/ | grep jpeg
-rw-r--r-- 1 root bin 2946954 Sep 30 20:46 libjpeg.a
-rw-r--r-- 1 root bin 613568 Sep 30 20:46 libjpeg.so.70.0
-rw-r--r-- 1 root bin 3580424 Sep 30 20:46 libturbojpeg.a
-rw-r--r-- 1 root bin 708328 Sep 30 20:46 libturbojpeg.so.0.0

I have also tried to flush the npm cache via npm cache clean --force just to ensure that it is not caching anything funny.

Any advice welcome, I am a bit stuck here.

Thanks

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.