Search code examples
npm-install

problem installing canvas on the discord bot i'm doing


When I run npm install canvas I get the following error in the console:

npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: This package is no longer supported. npm error code 1 npm error path C:\Users\SrTecc\Desktop\project\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\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Users\SrTecc\Desktop\project\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\SrTecc\Desktop\project\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 [email protected] npm error node-pre-gyp info using [email protected] | win32 | x64 npm error (node:17172) [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 [email protected] and [email protected] (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 [email protected] npm error gyp info using [email protected] | win32 | x64 npm error gyp info ok npm error gyp info it worked if it ends with ok npm error gyp info using [email protected] npm error gyp info using [email protected] | win32 | x64 npm error gyp info find Python using Python version 3.11.9 found at "C:\Users\SrTecc\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe" npm error gyp ERR! find VS npm error gyp ERR! find VS msvs_version not set from command line or npm config npm error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm 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.
npm error gyp ERR! find VS npm error gyp ERR! find VS Failure details: undefined npm 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.
npm error gyp ERR! find VS npm error gyp ERR! find VS Failure details: undefined npm error gyp ERR! find VS not looking for VS2017 as it is only supported up to Node.js 21 npm error gyp ERR! find VS not looking for VS2017 as it is only supported up to Node.js 21 npm error gyp ERR! find VS not looking for VS2017 as it is only supported up to Node.js 21 npm error gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18 npm error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 npm error gyp ERR! find VS npm error gyp ERR! find VS ************************************************************** npm error gyp ERR! find VS You need to install the latest version of Visual Studio npm error gyp ERR! find VS including the "Desktop development with C++" workload. npm error gyp ERR! find VS For more information consult the documentation at: npm error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows npm error gyp ERR! find VS ************************************************************** npm error gyp ERR! find VS npm error gyp ERR! configure error npm error gyp ERR! stack Error: Could not find any Visual Studio installation to use npm error gyp ERR! stack at VisualStudioFinder.fail (C:\Users\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:118:11) npm error gyp ERR! stack at VisualStudioFinder.findVisualStudio (C:\Users\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:17) npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:105:5) npm error gyp ERR! stack at async createBuildDir (C:\Users\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:112:18)
npm error gyp ERR! stack at async run (C:\Users\SrTecc\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.19045 npm error gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=C:\Users\SrTecc\Desktop\project\node_modules\canvas\build\Release\canvas.node" "--module_name=canvas" "--module_path=C:\Users\SrTecc\Desktop\project\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 C:\Users\SrTecc\Desktop\project\node_modules\canvas npm error gyp ERR! node -v v22.12.0 npm error gyp ERR! node-gyp -v v11.0.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\SrTecc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Users\SrTecc\Desktop\project\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\SrTecc\Desktop\project\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. (C:\Users\SrTecc\Desktop\project\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1101: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.19045 npm error node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\SrTecc\Desktop\project\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--update-binary" npm error node-pre-gyp ERR! cwd C:\Users\SrTecc\Desktop\project\node_modules\canvas npm error node-pre-gyp ERR! node -v v22.12.0 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm error node-pre-gyp ERR! not ok


Solution

  • You are using Node.js v22.12.0, which is very new and may not yet be fully supported by all packages. I think you should the version 20

    nvm install 20
    nvm use 20