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

Unable to install Canvas on windows 64 bit machine #2463

Open
rahulgupta-1009 opened this issue Dec 3, 2024 · 7 comments
Open

Unable to install Canvas on windows 64 bit machine #2463

rahulgupta-1009 opened this issue Dec 3, 2024 · 7 comments

Comments

@rahulgupta-1009
Copy link

We are trying to install the canvas manually as connecting to github and downloading via "npm install canvas" is blocked due to firewall restrictions.
So we have performed the steps mentioned on wiki like
1 - Made sure the pre-requisite are met i.e. python or version 3.12 or greater and node-gyp v10.
2- Installed node-gyp using command 'npm install -g node-gyp'.
3- Downloaded GTK2 from the given link and placed it onto C:/GTK directory.
4- We did not install the optional command.
5 - Tried to run the command 'npm install canvas' but it failed saying econnect timeout as it is trying to download through github.

So how can i do it if it is blocked by firewall ?

@npbenjohnson
Copy link

npbenjohnson commented Dec 4, 2024

#2448 and #2461 are potential duplicates,
This does have the GTK warnings and is run against node 22 lts, but after downgrading npm to the latest 20 the install just works without changing anything else.

npm error code 1
npm error path D:\source\points.common.vue\node_modules\canvas
npm error command failed
npm error command pwsh -c node-pre-gyp install --fallback-to-build --update-binary
npm error Warning: Missing input files:
npm error C:\GTK\bin\libpangowin32-1.0-0.dll
npm error C:\GTK\bin\libpng14-14.dll
npm error C:\GTK\bin\libfontconfig-1.dll
npm error C:\GTK\bin\libglib-2.0-0.dll
npm error C:\GTK\bin\libgmodule-2.0-0.dll
npm error C:\GTK\bin\libgthread-2.0-0.dll
npm error C:\GTK\bin\libpango-1.0-0.dll
npm error C:\GTK\bin\libintl-8.dll
npm error C:\GTK\bin\libpangoft2-1.0-0.dll
npm error C:\GTK\bin\libfreetype-6.dll
npm error C:\GTK\bin\libgobject-2.0-0.dll
npm error C:\GTK\bin\libexpat-1.dll
npm error C:\GTK\bin\libpangocairo-1.0-0.dll
npm error C:\GTK\bin\zlib1.dll
npm error C:\GTK\bin\libcairo-2.dll
npm error
npm error   Backend.cc
npm error D:\source\points.common.vue\node_modules\canvas\src\backend\Backend.h(3,10): error C1083: Cannot open include file: 'cairo.h': No such file or directory [D:\source\points.common.vue\node_modules\canvas\build\canvas.vcxproj]
npm error   (compiling source file '../src/backend/Backend.cc')
npm error
npm error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\BenJohnson\AppData\Roaming\nvm\v22.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --update-binary --module=D:\source\points.common.vue\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=D:\source\points.common.vue\node_modules\canvas\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (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@22.11.0 | win32 | x64
npm error (node:10796) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-win32-unknown-x64.tar.gz
npm error 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-v127-win32-unknown-x64.tar.gz
npm error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@22.11.0 (node-v127 ABI, unknown) (falling back to source compile with node-gyp)
npm error 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-v127-win32-unknown-x64.tar.gz
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.2.0
npm error gyp info using node@22.11.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.2.0
npm error gyp info using node@22.11.0 | win32 | x64
npm error gyp info find Python using Python version 3.11.9 found at "C:\Users\BenJohnson\AppData\Local\Programs\Python\Python311\python.exe"
npm error gyp info find VS using VS2022 (17.12.35527.113) found at:
npm error gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Professional"
npm error gyp info find VS run with --verbose for detailed information
npm error gyp info spawn C:\Users\BenJohnson\AppData\Local\Programs\Python\Python311\python.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'C:\\Users\\BenJohnson\\AppData\\Roaming\\nvm\\v22.11.0\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'msvs',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'D:\\source\\points.common.vue\\node_modules\\canvas\\build\\config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\BenJohnson\\AppData\\Roaming\\nvm\\v22.11.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\BenJohnson\\AppData\\Local\\node-gyp\\Cache\\22.11.0\\include\\node\\common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=C:\\Users\\BenJohnson\\AppData\\Local\\node-gyp\\Cache\\22.11.0',
npm error gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\BenJohnson\\AppData\\Roaming\\nvm\\v22.11.0\\node_modules\\npm\\node_modules\\node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\BenJohnson\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.11.0\\\\<(target_arch)\\\\node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=D:\\source\\points.common.vue\\node_modules\\canvas',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'D:\\source\\points.common.vue\\node_modules\\canvas\\build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info ok
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.2.0
npm error gyp info using node@22.11.0 | win32 | x64
npm error gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'build\\binding.sln',
npm error gyp info spawn args '/clp:Verbosity=minimal',
npm error gyp info spawn args '/nologo',
npm error gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm error gyp info spawn args ]
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\BenJohnson\AppData\Roaming\nvm\v22.11.0\node_modules\npm\node_modules\node-gyp\lib\build.js:216:23)
npm error gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Windows_NT 10.0.22631
npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\BenJohnson\\AppData\\Roaming\\nvm\\v22.11.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=D:\\source\\points.common.vue\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=D:\\source\\points.common.vue\\node_modules\\canvas\\build\\Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
npm error gyp ERR! cwd D:\source\points.common.vue\node_modules\canvas
npm error gyp ERR! node -v v22.11.0
npm error gyp ERR! node-gyp -v v10.2.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\BenJohnson\AppData\Roaming\nvm\v22.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --update-binary --module=D:\source\points.common.vue\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=D:\source\points.common.vue\node_modules\canvas\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
npm error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\source\points.common.vue\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1104:16)
npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm error node-pre-gyp ERR! System Windows_NT 10.0.22631
npm error node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\source\\points.common.vue\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm error node-pre-gyp ERR! cwd D:\source\points.common.vue\node_modules\canvas
npm error node-pre-gyp ERR! node -v v22.11.0
npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm error node-pre-gyp ERR! not ok
npm error A complete log of this run can be found in: D:\npm\_logs\2024-12-04T08_35_30_158Z-debug-0.log

@cclauss
Copy link
Contributor

cclauss commented Dec 4, 2024

GitHub Actions tests are also failing on Windows.

@chearon
Copy link
Collaborator

chearon commented Dec 5, 2024

That's fixed by #2458. Was hoping for a review, but I'll just merge it now.

@cclauss
Copy link
Contributor

cclauss commented Dec 5, 2024

Great! Unfortunately the GitHub Actions for Windows are failing because some of the dependencies are not at the FTP sites that they used to be.

I will try to rebase

EDIT: The Windows dependencies are still failing the GitHub Actions. :-(

@Asleep123
Copy link

That's fixed by #2458. Was hoping for a review, but I'll just merge it now.

Thanks, was going crazy over this issue. How do I install this commit with pnpm? Based on the activity of this repo, it doesn't seem like it'll get released any time soon.

@cclauss
Copy link
Contributor

cclauss commented Dec 6, 2024

@Asleep123 Linux and macOS seem to install and test just fine.

Windows works in

@EGGamer
Copy link

EGGamer commented Dec 9, 2024

I'm having the same issue here. Did anybody find a solution or workaround?

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

No branches or pull requests

6 participants