无法安装画布

Posted

技术标签:

【中文标题】无法安装画布【英文标题】:Unable to install Canvas 【发布时间】:2021-03-17 10:27:54 【问题描述】:

我想将 canvas 模块添加到我的 discord.js 机器人中,但是我在终端中遇到了很多错误,并且我的机器人中断了。 即使我使用 node.js,错误也提到了 Python

还有其他人有这个问题吗? 我该如何解决这个问题?

之前的错误说我需要下载最新版本的Python,所以我做了

调试日志中的错误:

430 error code 1
431 error path C:\Users\ADMIN\Desktop\bot\node_modules\canvas
432 error command failed
433 error command C:\Windows\system32\cmd.exe /d /s /c "node-pre-gyp install --fallback-to-build"
434 error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\ADMIN\Desktop\bot\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\ADMIN\Desktop\bot\node_modules\canvas\build\Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
435 error node-pre-gyp info it worked if it ends with ok
435 error node-pre-gyp info using node-pre-gyp@0.11.0
435 error node-pre-gyp info using node@15.0.1 | win32 | x64
435 error node-pre-gyp WARN Using needle for node-pre-gyp https download
435 error node-pre-gyp info check checked for "C:\Users\ADMIN\Desktop\bot\node_modules\canvas\build\Release\canvas.node" (not found)
435 error node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-win32-unknown-x64.tar.gz
435 error node-pre-gyp http 404 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-win32-unknown-x64.tar.gz
435 error node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-win32-unknown-x64.tar.gz
435 error node-pre-gyp WARN Pre-built binaries not found for canvas@2.6.1 and node@15.0.1 (node-v88 ABI, unknown) (falling back to source compile with node-gyp)
435 error node-pre-gyp http 404 status code downloading tarball https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-win32-unknown-x64.tar.gz
435 error gyp info it worked if it ends with ok
435 error gyp info using node-gyp@7.1.2
435 error gyp info using node@15.0.1 | win32 | x64
435 error gyp info ok
435 error gyp info it worked if it ends with ok
435 error gyp info using node-gyp@7.1.2
435 error gyp info using node@15.0.1 | win32 | x64
435 error gyp info find Python using Python version 3.9.0 found at "C:\Users\ADMIN\AppData\Local\Programs\Python\Python39\python.exe"
435 error gyp http GET https://nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
435 error gyp http 200 https://nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
435 error gyp http GET https://nodejs.org/download/release/v15.0.1/SHASUMS256.txt
435 error gyp http GET https://nodejs.org/download/release/v15.0.1/win-x86/node.lib
435 error gyp http GET https://nodejs.org/download/release/v15.0.1/win-x64/node.lib
435 error gyp http GET https://nodejs.org/download/release/v15.0.1/win-arm64/node.lib
435 error gyp http 200 https://nodejs.org/download/release/v15.0.1/SHASUMS256.txt
435 error gyp http 404 https://nodejs.org/download/release/v15.0.1/win-arm64/node.lib
435 error gyp http 200 https://nodejs.org/download/release/v15.0.1/win-x86/node.lib
435 error gyp http 200 https://nodejs.org/download/release/v15.0.1/win-x64/node.lib
435 error gyp ERR! find VS
435 error gyp ERR! find VS msvs_version not set from command line or npm config
435 error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
435 error gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
435 error gyp ERR! find VS looking for Visual Studio 2015
435 error gyp ERR! find VS - not found
435 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
435 error gyp ERR! find VS
435 error gyp ERR! find VS **************************************************************
435 error gyp ERR! find VS You need to install the latest version of Visual Studio
435 error gyp ERR! find VS including the "Desktop development with C++" workload.
435 error gyp ERR! find VS For more information consult the documentation at:
435 error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
435 error gyp ERR! find VS **************************************************************
435 error gyp ERR! find VS
435 error gyp ERR! configure error
435 error gyp ERR! stack Error: Could not find any Visual Studio installation to use
435 error gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
435 error gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
435 error gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
435 error gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
435 error gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
435 error gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
435 error gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
435 error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:316:5)
435 error gyp ERR! stack     at ChildProcess.emit (node:events:327:20)
435 error gyp ERR! stack     at maybeClose (node:internal/child_process:1048:16)
435 error gyp ERR! System Windows_NT 10.0.19041
435 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\ADMIN\\Desktop\\bot\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=C:\\Users\\ADMIN\\Desktop\\bot\\node_modules\\canvas\\build\\Release" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v88"
435 error gyp ERR! cwd C:\Users\ADMIN\Desktop\bot\node_modules\canvas
435 error gyp ERR! node -v v15.0.1
435 error gyp ERR! node-gyp -v v7.1.2
435 error gyp ERR! not ok
435 error node-pre-gyp ERR! build error
435 error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\ADMIN\Desktop\bot\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\ADMIN\Desktop\bot\node_modules\canvas\build\Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
435 error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\ADMIN\Desktop\bot\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
435 error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:327:20)
435 error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1048:16)
435 error node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
435 error node-pre-gyp ERR! System Windows_NT 10.0.19041
435 error node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ADMIN\\Desktop\\bot\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
435 error node-pre-gyp ERR! cwd C:\Users\ADMIN\Desktop\bot\node_modules\canvas
435 error node-pre-gyp ERR! node -v v15.0.1
435 error node-pre-gyp ERR! node-pre-gyp -v v0.11.0
435 error node-pre-gyp ERR! not ok
436 verbose exit 1

【问题讨论】:

帮助我们帮助您 - 分享错误 我应该在 Visual Studio Code 中发送调试日志还是错误消息? 如果可以的话,分享两者。现在。没有足够的信息可以帮助您。希望其中一个会有一些有用的指针 有400多行,我怎么分享这个?编辑:我只会发布有错误的行 【参考方案1】:

当时似乎这是一个错误,我现在尝试安装它并且它可以工作

编辑:我的机器人现在无法启动

【讨论】:

以上是关于无法安装画布的主要内容,如果未能解决你的问题,请参考以下文章

无法在多个画布上绘制

无法在javascript中将图像绘制到画布

从画布获取 img (toDataURL) --> 可能无法导出受污染的画布

无法在画布上绘制垂直虚线

无法在部分画布上绘图

无法移动画布或更改任何变换值