Automattic / node-canvas

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

Installation issue, url is blocked by our proxy. #2017

Open WentingTan opened 2 years ago

WentingTan commented 2 years ago

Issue or Feature

We are working on upgrading a new version of galata (v4.2.2) and "canvas" is one of the dependencies. We have an issue here: ‘node-canvas' install script tries to download the package from "{https://github.com/Automattic/node-canvas/releases/..."}, which is a url blocked by our company’s proxy (we literally block all third party urls). Canvas is available on our artifact, don't know why the install script doesn't pull the package from artifact. We are thinking to pre-install canvas manually in our docker container. However, we tried a few ways:

and

both failed and it shows again it tries to download the pkg from the url (which is blocked by our proxy).

Error message:


node-pre-gyp ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v72-linux-glibc-x64.tar.gz failed, reason: connect ECONNREFUSED 140.82.112.3:443 
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.9.1 and node@12.13.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error request to https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v72-linux-glibc-x64.tar.gz failed, reason: connect ECONNREFUSED 140.82.112.3:443 

Is there a way to pre install canvas and avoid download from that git url?

gulatirajat commented 2 years ago

Similar scenario and similar issue at my end. The build errors out while trying to connect to and download from: https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v83-linux-glibc-x64.tar.gz

I have tried providing proxy params to docker build using --build-args, however that does not works due to restrictions on our enterprise jenkins.

I have tried these steps as well, however that has not helped: https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems

image

Container details: NAME="Ubuntu" VERSION="18.04.6 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.6 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic

node -v v14.19.1 npm -v 6.14.16

Is there something I am missing in trying to follow the steps here: https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems

exige81 commented 3 weeks ago

If there is a mirror that you can access, you can tell node-pre-gyp to use --canvas_binary_host_mirror See #1771