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

Throws errors when launching Electron app and when reinstalling #214

Open
Konglomneshued opened this issue May 15, 2023 · 1 comment
Open
Labels
question Further information is requested

Comments

@Konglomneshued
Copy link

Error when running my Electron app

App threw an error during load

Error: The module '/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 109. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1810)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1810)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1120:14)

A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 109. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1810)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1810)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1120:14)

I've tried deleting my package-lock.json and node_modules folder and re-running npm i

> electron-template@1.0.0 postinstall
> electron-builder install-app-deps

  • electron-builder  version=23.6.0
  • loaded configuration  file=/home/untitled1/VSCodeProjects/batcher/electron-builder.yml
  • rebuilding native dependencies  dependencies=canvas@2.10.2 platform=linux arch=x64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm ERR! code 1
    npm ERR! path /home/untitled1/VSCodeProjects/batcher/node_modules/canvas
    npm ERR! command failed
    npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
    npm ERR! Failed to execute '/home/untitled1/.volta/tools/image/node/18.16.0/bin/node /home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v21.4' (1)
    npm ERR! node-pre-gyp info it worked if it ends with ok
    npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
    npm ERR! node-pre-gyp info using node@18.16.0 | linux | x64
    npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-electron-v21.4-linux-glibc-x64.tar.gz
    npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-electron-v21.4-linux-glibc-x64.tar.gz 
    npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.2 and electron@21.4.4 (electron-v21.4 ABI, glibc) (falling back to source compile with node-gyp) 
    npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-electron-v21.4-linux-glibc-x64.tar.gz 
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.3.1
    npm ERR! gyp info using node@18.16.0 | linux | x64
    npm ERR! gyp info ok 
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.3.1
    npm ERR! gyp info using node@18.16.0 | linux | x64
    npm ERR! gyp info find Python using Python version 3.11.3 found at "/usr/bin/python3"
    npm ERR! gyp info spawn /usr/bin/python3
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    npm ERR! gyp info spawn args   'binding.gyp',
    npm ERR! gyp info spawn args   '-f',
    npm ERR! gyp info spawn args   'make',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/untitled1/.electron-gyp/21.4.4/include/node/common.gypi',
    npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
    npm ERR! gyp info spawn args   '-Dvisibility=default',
    npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/untitled1/.electron-gyp/21.4.4',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/untitled1/.electron-gyp/21.4.4/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas',
    npm ERR! gyp info spawn args   '-Dnode_engine=v8',
    npm ERR! gyp info spawn args   '--depth=.',
    npm ERR! gyp info spawn args   '--no-parallel',
    npm ERR! gyp info spawn args   '--generator-output',
    npm ERR! gyp info spawn args   'build',
    npm ERR! gyp info spawn args   '-Goutput_dir=.'
    npm ERR! gyp info spawn args ]
    npm ERR! Package pixman-1 was not found in the pkg-config search path.
    npm ERR! Perhaps you should add the directory containing `pixman-1.pc'
    npm ERR! to the PKG_CONFIG_PATH environment variable
    npm ERR! Package 'pixman-1', required by 'virtual:world', not found
    npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
    npm ERR! gyp ERR! configure error 
    npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    npm ERR! gyp ERR! System Linux 6.2.15-300.fc38.x86_64
    npm ERR! gyp ERR! command "/home/untitled1/.volta/tools/image/node/18.16.0/bin/node" "/home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v21.4"
    npm ERR! gyp ERR! cwd /home/untitled1/VSCodeProjects/batcher/node_modules/canvas
    npm ERR! gyp ERR! node -v v18.16.0
    npm ERR! gyp ERR! node-gyp -v v9.3.1
    npm ERR! gyp ERR! not ok 
    npm ERR! node-pre-gyp ERR! build error 
    npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/home/untitled1/.volta/tools/image/node/18.16.0/bin/node /home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/untitled1/VSCodeProjects/batcher/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v21.4' (1)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/untitled1/VSCodeProjects/batcher/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    npm ERR! node-pre-gyp ERR! System Linux 6.2.15-300.fc38.x86_64
    npm ERR! node-pre-gyp ERR! command "/home/untitled1/.volta/tools/image/node/18.16.0/bin/node" "/home/untitled1/VSCodeProjects/batcher/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
    npm ERR! node-pre-gyp ERR! cwd /home/untitled1/VSCodeProjects/batcher/node_modules/canvas
    npm ERR! node-pre-gyp ERR! node -v v18.16.0
    npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
    npm ERR! node-pre-gyp ERR! not ok
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/untitled1/.npm/_logs/2023-05-15T02_49_01_414Z-debug-0.log
    
                    command=/home/untitled1/.volta/tools/image/node/18.16.0/bin/node /home/untitled1/.volta/tools/image/node/18.16.0/lib/node_modules/npm/bin/npm-cli.js rebuild canvas@2.10.2
                    workingDir=
npm ERR! code 1
npm ERR! path /home/untitled1/VSCodeProjects/batcher
npm ERR! command failed
npm ERR! command sh -c electron-builder install-app-deps

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/untitled1/.npm/_logs/2023-05-15T02_47_31_149Z-debug-0.log
  • Node v18.16.0
  • NPM 9.5.1
  • This library version ^2.1.1
@k-yle
Copy link
Owner

k-yle commented May 15, 2023

The relevant line is:

npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.2 and electron@21.4.4 (electron-v21.4 ABI, glibc) (falling back to source compile with node-gyp) 

It sounds like node-canvas doesn't support your version of electron

@k-yle k-yle added the question Further information is requested label May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants