Automattic / node-canvas

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

NPM error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@20.16.0 in Win 11 Enterprise #2421

Open krthk6000 opened 2 months ago

krthk6000 commented 2 months ago

Issue

npm error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@20.16.0

Steps to Reproduce

npm install canvas or npm install canvas@next

Your Environment

System Details

Error Log

npm error code 1 npm error path C:\Dev\pdf-visual-diff\node_modules\canvas npm error command failed npm error command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --update-binary npm error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1) npm error node-pre-gyp info it worked if it ends with ok npm error node-pre-gyp info using node-pre-gyp@1.0.11 npm error node-pre-gyp info using node@20.16.0 | win32 | x64 npm error node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-win32-unknown-x64.tar.gz npm error node-pre-gyp ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-win32-unknown-x64.tar.gz failed, reason: getaddrinfo ENOTFOUND github.com npm error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@20.16.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) npm error node-pre-gyp WARN Hit error request to https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-win32-unknown-x64.tar.gz failed, reason: getaddrinfo ENOTFOUND github.com npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.1.0 npm error gyp info using node@20.16.0 | win32 | x64 npm error gyp info ok npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.1.0 npm error gyp info using node@20.16.0 | win32 | x64 npm error gyp info find Python using Python version 3.11.4 found at "C:\Users\UXXXXXX\AppData\Local\Programs\Python\Python311\python.exe" npm error gyp http GET https://nodejs.org/download/release/v20.16.0/node-v20.16.0-headers.tar.gz npm error gyp http fetch GET https://nodejs.org/download/release/v20.16.0/node-v20.16.0-headers.tar.gz attempt 1 failed with ENOTFOUND npm error gyp WARN install got an error, rolling back install npm error gyp ERR! configure error npm error gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and npm error gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad npm error gyp ERR! stack network settings. npm error gyp ERR! stack at go (C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:244:21) npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm error gyp ERR! stack at async install (C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:63:18) npm error gyp ERR! stack at async getNodeDir (C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:79:7) npm error gyp ERR! stack at async run (C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js:81:18) npm error gyp ERR! System Windows_NT 10.0.22621 npm error gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release\canvas.node" "--module_name=canvas" "--module_path=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115" npm error gyp ERR! cwd C:\Dev\pdf-visual-diff\node_modules\canvas npm error gyp ERR! node -v v20.16.0 npm error gyp ERR! node-gyp -v v10.1.0 npm error gyp ERR! not ok npm error node-pre-gyp ERR! build error npm error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\UXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Dev\pdf-visual-diff\node_modules\canvas\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1) npm error node-pre-gyp ERR! stack at ChildProcess. (C:\Dev\pdf-visual-diff\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28) npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) npm error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) npm error node-pre-gyp ERR! System Windows_NT 10.0.22621 npm error node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Dev\pdf-visual-diff\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm error node-pre-gyp ERR! cwd C:\Dev\pdf-visual-diff\node_modules\canvas npm error node-pre-gyp ERR! node -v v20.16.0 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm error node-pre-gyp ERR! not ok

guidrop17 commented 1 month ago

I have the same error, how did you fix it?

krthk6000 commented 1 month ago

I have the same error, how did you fix it? @guidrop17

It hasn't been resolved yet, I'm still waiting for someone to provide a solution.

exige81 commented 3 weeks ago

The error is showing a not found on the github prebuilt binary. This can happen if you're behind a firewall like in an enterprise environment for example. If so you may need to point the installation to a mirror that you can access.

https://github.com/mapbox/node-pre-gyp/issues/526 shows how you can use the --canvas_binary_host_mirror flag to set the mirror location