Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when installing Canvas node-gyp rebuild #913

Closed
EsteveSegura opened this issue May 2, 2017 · 26 comments
Closed

error when installing Canvas node-gyp rebuild #913

EsteveSegura opened this issue May 2, 2017 · 26 comments

Comments

@EsteveSegura
Copy link

EsteveSegura commented May 2, 2017

Issue or Feature

error when installing with npm

Steps to Reproduce

sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
npm install --save canvas

Your Environment

Node version =7.4.0
Npm version = 4.0.5
OS = ubutu 12.04 LTS

Log

npm-debug.log.txt

@joncodo
Copy link

joncodo commented May 15, 2017

I am also seeing this error after an npm i canvas

Node: 6.9.0
npm: 3.10.8
OSX-10.12.4

Note that brew install pkg-config cairo pango libpng jpeg giflib passes no problem

npm-debug.log.txt

@joe-campiondigital-mo
Copy link

I think this is also mentioned on #911

I ran npm install [email protected] to get a working version

@ghost
Copy link

ghost commented Aug 9, 2017

Followed the steps here: https://github.com/Automattic/node-canvas/wiki/Installation---OSX

Then ran:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig
npm install canvas

Worked for me

@grettygoose
Copy link

This worked for me...
https://gist.github.com/simeg/b2011f13bc7e415c26fea14a2a404fb3

$ npm install -g node-gyp
$ brew install pkg-config cairo libpng jpeg giflib
$ npm install canvas

@shan-du
Copy link

shan-du commented Feb 23, 2018

If the above solution doesn't work, try uninstall node-gyp first

sudo npm uninstall -g node-gyp
sudo npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib

OSX: 10.12.5
node: 7.10.1
npm: 4.2.0

@nrogap
Copy link

nrogap commented Jun 20, 2018

https://github.com/Automattic/node-canvas#installation

@zbjornson
Copy link
Collaborator

If your install logs just say:

Error: [email protected] install: `node-gyp rebuild`
  Exit status 1

(as the two posted in this issue do), there's not enough info to troubleshoot. To get full build output, clone this repository and run node-gyp rebuild directly. (I don't know of an easier way -- if someone else does, please share!)

Closing since it looks like a lot of people found solutions, and not info info to debug others.

@FlagAni
Copy link

FlagAni commented Feb 10, 2022

still impossible

@WentingTan
Copy link

Hi there, I am installing canvas in my docker container using the cmd : npm install canvas
The installation failed and this is the error message:

`node-pre-gyp ERR! install response status 403 Forbidden on https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v72-linux-glibc-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 403 Forbidden on https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v72-linux-glibc-x64.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: tunneling socket could not be established, statusCode=403
gyp ERR! stack at ClientRequest.onConnect (/usr/local/lib/node_modules/npm/node_modules/tunnel-agent/index.js:166:19)
gyp ERR! stack at Object.onceWrapper (events.js:300:26)
gyp ERR! stack at ClientRequest.emit (events.js:210:5)
gyp ERR! stack at Socket.socketOnData (_http_client.js:490:11)
gyp ERR! stack at Socket.emit (events.js:210:5)
gyp ERR! stack at addChunk (_stream_readable.js:308:12)
gyp ERR! stack at readableAddChunk (_stream_readable.js:289:11)
gyp ERR! stack at Socket.Readable.push (_stream_readable.js:223:10)
gyp ERR! stack at TCP.onStreamRead (internal/stream_base_commons.js:182:23)
gyp ERR! System Linux 4.19.121-linuxkit
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=/src_dir/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/src_dir/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /src_dir/node_modules/canvas
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
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=/src_dir/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/src_dir/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. (/src_dir/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5)
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:283:5)
node-pre-gyp ERR! System Linux 4.19.121-linuxkit
node-pre-gyp ERR! command "/usr/local/bin/node" "/src_dir/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /src_dir/node_modules/canvas
node-pre-gyp ERR! node -v v12.13.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.8
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=/src_dir/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/src_dir/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! /src_dir/jlabapp/npm-cache/_logs/2022-03-22T23_19_49_875Z-debug.log`

Any idea about how to resolve?

@nrogap
Copy link

nrogap commented Mar 23, 2022

@WentingTan Did you try this?
npm install --build-from-source

@zbjornson
Copy link
Collaborator

tunneling socket could not be established,

You're most likely behind a proxy that is blocking the download.

@WentingTan
Copy link

@WentingTan Did you try this? npm install --build-from-source

Yes we tried that. Seems it still tries to download from web and eventually hit the same error.

@WentingTan
Copy link

tunneling socket could not be established,

You're most likely behind a proxy that is blocking the download.

We were thinking about the same root cause. If our proxy blocks external links. Is there a way to bypass the download?

@kaiserkiwi
Copy link

Same issue here with macOS 12.3 on a M1 Pro. Tried all options from above. :/

@zbjornson
Copy link
Collaborator

You might be able to work-around your proxy by setting the https-proxy and proxy npm variables, but otherwise I'd ask your proxy administrator for guidance as to why they're blocking it. It could also be that your client cert bundle is out of date.

@wizofaus
Copy link

FWIW I had this error:

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error connect ETIMEDOUT 13.237.44.5:443
Package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

But on a 2nd try it worked just fine...

@ShlokChaitanya
Copy link

Download and extract this file in C:\GTK
File: https://mirror.ossplanet.net/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip
And Try This commands:
npm install -g node-gyp
npm install pkg-config cairo libpng jpeg giflib
npm install canvas

@Farion-55
Copy link

hey listen than i install brew install pkg-config cairo libpng jpeg giflib i get error brew : The term 'brew' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • brew install pkg-config cairo pango libpng jpeg giflib librsvg
  •   + CategoryInfo          : ObjectNotFound: (brew:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

@Metachemix1
Copy link

hey listen than i install brew install pkg-config cairo libpng jpeg giflib i get error brew : The term 'brew' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • brew install pkg-config cairo pango libpng jpeg giflib librsvg
  •   + CategoryInfo          : ObjectNotFound: (brew:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

This will only work on MacOS or linux (if using homebrew there). Based on the output you are providing this looks like PowerShell (Windows) :)

@niksseif
Copy link

I was getting this error npm ERR! command failed npm ERR! command sh -c node-pre-gyp install --fallback-to-build
I first installed Cairo by running 👇🏼 command
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
After that I ran npm i canvas. Fixed my problem.

@gagangoku
Copy link

See https://stackoverflow.com/a/73308867/2557517

@madilekci-avena
Copy link

This worked for me... gist.github.com/simeg/b2011f13bc7e415c26fea14a2a404fb3

$ npm install -g node-gyp $ brew install pkg-config cairo libpng jpeg giflib $ npm install canvas

Also worked for me on MacOS Ventura 13.4 (22F66). I was trying to do yarn install and it was giving same error.

@durikr
Copy link

durikr commented Sep 3, 2023

What worked for me was switching to bash terminal instead of zsh. Then it was installed immediately via npm install canvas

@ohabash
Copy link

ohabash commented Apr 8, 2024

None of this helped. Please help

npm i canvas output =>
canvas-install.txt

Screenshot 2024-04-08 at 11 22 40 AM

Python 3.12.2
{
  'fornida-services-nx': '0.0.1',
  npm: '8.19.3',
  node: '18.13.0',
  v8: '10.2.154.23-node.21',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '6.0.10',
  uvwasi: '0.0.13',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022f',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}

@zhaxie
Copy link

zhaxie commented May 17, 2024

None of this helped. Please help

npm i canvas output => canvas-install.txt

Screenshot 2024-04-08 at 11 22 40 AM

Python 3.12.2
{
  'fornida-services-nx': '0.0.1',
  npm: '8.19.3',
  node: '18.13.0',
  v8: '10.2.154.23-node.21',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '6.0.10',
  uvwasi: '0.0.13',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022f',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}

My compute is macbook m1 , do brew install [email protected] , resolve it, because [email protected] removed the distutils, so it case install failed

@thetnaingtn
Copy link

If anyone having problem because of [email protected] remove distutils please try

brew install python-setuptools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests