Skip to content
New issue

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

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

Already on GitHub? # to your account

Install error #1825

Closed
ghost opened this issue Jun 7, 2021 · 12 comments
Closed

Install error #1825

ghost opened this issue Jun 7, 2021 · 12 comments

Comments

@ghost
Copy link

ghost commented Jun 7, 2021

I was trying to install the node canvas and happened a error

node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v83-android-unknown-arm.tar.gz

Help me pls

@zbjornson
Copy link
Collaborator

Please see #1511: prebuilds aren't available for ARM CPUs, so you need to build from source (https://github.com/Automattic/node-canvas/wiki#installation-guides).

@josephEncheckal
Copy link

Please see #1511: prebuilds aren't available for ARM CPUs, so you need to build from source (https://github.com/Automattic/node-canvas/wiki#installation-guides).

worked in ubuntu (AWS ec2)

@hasan-retrace
Copy link

Thanks @josephEncheckal , that worked.

@omergulen
Copy link

omergulen commented Apr 6, 2022

Please see #1511: prebuilds aren't available for ARM CPUs, so you need to build from source (https://github.com/Automattic/node-canvas/wiki#installation-guides).

Using Apple M1 here, installing the dependencies with brew as the following, from the link you've given solved the issue for me, which I was getting on npm install on another project.

brew install pkg-config cairo pango libpng jpeg giflib librsvg

Thanks! 🎉

@davidecarpini
Copy link

davidecarpini commented Mar 17, 2023

Please see #1511: prebuilds aren't available for ARM CPUs, so you need to build from source (https://github.com/Automattic/node-canvas/wiki#installation-guides).

Using Apple M1 here, installing the dependencies with brew from the link you've given solved the issue I was getting on npm install on another project.

Thanks! 🎉

thanks to @omergulen and the link
https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X

brew install pkg-config cairo pango libpng jpeg giflib librsvg

fixed it

@pnutmath
Copy link

pnutmath commented Apr 26, 2023

How this work with alpine images? getting similar issue while using pdfjs-dist:

Cannot find module 'canvas'\nRequire stack:\n- /srv/node_modules/pdfjs-dist/legacy/build/pdf.js

Actually this canvas is not getting installed in alpine images:

warning Error running install script for optional dependency: "/srv/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /srv/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.10
node-pre-gyp info using node@18.16.0 | linux | x64
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@18.16.0 (node-v108 ABI, musl) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.16.0 | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.16.0 | linux | x64
gyp ERR! find Python 
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python 
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Linux 5.10.162+
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\" \"--update-binary\" \"--module=/srv/node_modules/canvas/build/Release/canvas.node\" \"--module_name=canvas\" \"--module_path=/srv/node_modules/canvas/build/Release\" \"--napi_version=8\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v108\"
gyp ERR! cwd /srv/node_modules/canvas
gyp ERR! node -v v18.16.0
gyp ERR! node-gyp -v v9.3.1
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 --update-binary --module=/srv/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/srv/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/srv/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Linux 5.10.162+
node-pre-gyp ERR! command \"/usr/local/bin/node\" \"/srv/node_modules/canvas/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\" \"--update-binary\"
node-pre-gyp ERR! cwd /srv/node_modules/canvas
node-pre-gyp ERR! node -v v18.16.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
node-pre-gyp ERR! not ok 

@wisetc
Copy link

wisetc commented May 10, 2023

^CWarning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
Warning: cairo 1.16.0_5 is already installed and up-to-date.
To reinstall 1.16.0_5, run:
  brew reinstall cairo
Warning: libpng 1.6.39 is already installed and up-to-date.
To reinstall 1.6.39, run:
  brew reinstall libpng
Warning: giflib 5.2.1 is already installed and up-to-date.
To reinstall 5.2.1, run:
  brew reinstall giflib

M2 apple silicon

@katerlloyd
Copy link

katerlloyd commented Jun 28, 2023

Running brew install pkg-config cairo pango libpng jpeg giflib librsvg fixed it on my M2 Apple Silicon.
I also added these to my .zshrc file:

export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib"
export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"

@yanxiangzhou
Copy link

Using Apple M2 here, installing the dependencies with brew as the following, from the link you've given solved the issue for me, which I was getting on npm install on another project.

arch -arm64 brew install pkg-config cairo pango libpng jpeg giflib librsvg

@mycharoka
Copy link

mycharoka commented Apr 30, 2024

I was trying to install the node canvas and happened a error

node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v83-android-unknown-arm.tar.gz

Help me pls

I think I just find a way out of it, so I notice my log said
npm ERR! File "/Users/muhammadvidi/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 42, in
npm ERR! import gyp # noqa: E402
npm ERR! ^^^^^^^^^^
npm ERR! File "/Users/muhammadvidi/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 9, in
npm ERR! import gyp.input
npm ERR! File "/Users/muhammadvidi/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in
npm ERR! from distutils.version import StrictVersion
npm ERR! ModuleNotFoundError: No module named 'distutils'

and so I tried to change my node version into v16.20.2 (i'm using nvm btw) and I change my python version that's being use globally. So on my mac I have python v3.12.2 installed from brew and then I installed pyenv from brew and then I did pyenv install 3.10.4 (or maybe tried to install any 3.10 version maybe) and I hit npm i and voila it runs perfectly.
the idea to using python v3.10 is from this stackoverflow article solution

goodluck guys!

@damdeez
Copy link

damdeez commented Jun 24, 2024

Noting this for reference for others: If your company has strict VPN security it could cause this error to pop up. I would contact your security and get an exception or disconnect from VPN and try npm i again

@MeirP-3
Copy link

MeirP-3 commented Jun 24, 2024

MacOS Sonoma 14.5 failed npm install canvas.

After digging in the error log, root cause were errors similar to error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header..

Solution was:

export SDKROOT=$(xcrun --show-sdk-path)
npm install canvas

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

No branches or pull requests