fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
29.22k stars 3.52k forks source link

[Bug]: Electron-force packaging prompts canvas failed to rebuild error #10243

Open pengrun opened 1 month ago

pengrun commented 1 month ago

CheckList

Version

6.0.2

In What environments are you experiencing the problem?

Chrome

Node Version (if applicable)

20.15.0

Link To Reproduction

https://codesandbox.io/p/devbox/fabric-node-sandbox-forked-xewlhg

Steps To Reproduce

  1. rm -rf node_modules/
  2. yarn.lock 3.yarn install 4.yarn make-debug

Expected Behavior

The project should compile and serve without errors.

Actual Behavior

It has been bothering me for a long time, and in the end, I chose to remove the remaining dependencies to locate the problem. When using other dependencies without fabric, make can succeed, but when using fabric, it does not succeed. The packagejson is as follows: image

The execution code is as follows: image

Error Message & Stack Trace

(myenv) root@8064c052a0ca:/healthmanage# yarn make-debug
yarn run v1.22.22
$ DEBUG=electron-forge:* electron-forge make
✔ Checking your system

electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms
❯ Loading configuration
  electron-forge:project-resolver searching for project in: /healthmanage +0ms
  electron-forge:project-resolver package.json with forge dependency found in /healthmanage/package.json +24ms
  electron-forge:import-search searching [
  '@electron-forge/plugin-auto-unpack-natives',
  '/healthmanage/@electron-forge/plugin-auto-unpack-natives',
  '/healthmanage/node_modules/@electron-forge/plugin-auto-unpack-natives'
] relative to /healthmanage +0ms
  electron-forge:import-search testing @electron-forge/plugin-auto-unpack-natives +11ms
✔ Loading configuration
❯ Resolving make targets
  electron-forge:import-search searching [
  '@electron-forge/maker-squirrel',
  '/healthmanage/@electron-forge/maker-squirrel',
  '/healthmanage/node_modules/@electron-forge/maker-squirrel'
] relative to /healthmanage +69ms
  electron-forge:import-search testing @electron-forge/maker-squirrel +1ms
  electron-forge:import-search searching [
  '@electron-forge/maker-zip',
  '/healthmanage/@electron-forge/maker-zip',
  '/healthmanage/node_modules/@electron-forge/maker-zip'
] relative to /healthmanage +1s
  electron-forge:import-search testing @electron-forge/maker-zip +1ms
  electron-forge:import-search searching [
  '@electron-forge/maker-deb',
  '/healthmanage/@electron-forge/maker-deb',
  '/healthmanage/node_modules/@electron-forge/maker-deb'
] relative to /healthmanage +65ms
  electron-forge:import-search testing @electron-forge/maker-deb +1ms
  electron-forge:import-search searching [
  '@electron-forge/maker-rpm',
  '/healthmanage/@electron-forge/maker-rpm',
  '/healthmanage/node_modules/@electron-forge/maker-rpm'
] relative to /healthmanage +3s
  electron-forge:import-search testing @electron-forge/maker-rpm +2ms
› Making for the following targets: ,
✔ Resolving make targets
❯ Running package command
❯ Preparing to package application
  electron-forge:project-resolver searching for project in: /healthmanage +7s
  electron-forge:project-resolver package.json with forge dependency found in /healthmanage/package.json +13ms
  electron-forge:import-search searching [
  '@electron-forge/plugin-auto-unpack-natives',
  '/healthmanage/@electron-forge/plugin-auto-unpack-natives',
  '/healthmanage/node_modules/@electron-forge/plugin-auto-unpack-natives'
] relative to /healthmanage +1s
  electron-forge:import-search testing @electron-forge/plugin-auto-unpack-natives +4ms
✔ Preparing to package application
❯ Running packaging hooks
❯ Running generateAssets hook
✔ Running generateAssets hook
❯ Running prePackage hook
✔ Running prePackage hook
✔ Running packaging hooks
❯ Packaging application
› Determining targets...
  electron-forge:packager packaging with options {
  asar: { unpack: '{**/*.node,**/*.node}' },
  overwrite: true,
  ignore: [ '.git', '.vscode', 'node_modules/.cache', 'src' ],
  name: 'healthmanage',
  productName: 'healthmanage',
  icon: './dist/favicon',
  version: '1.0.0',
  copyright: 'Copyright © 2024 Hongyan (Chongqing) Defense rights reserved.',
  author: 'Hongyan (Chongqing) Defense Technology Co., Ltd',
  quiet: true,
  dir: '/healthmanage',
  arch: 'arm64',
  platform: 'linux',
  afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ],
  afterComplete: [ [AsyncFunction (anonymous)] ],
  afterCopy: [ [AsyncFunction (anonymous)] ],
  afterExtract: [ [AsyncFunction (anonymous)] ],
  afterPrune: [ [AsyncFunction (anonymous)] ],
  out: '/healthmanage/out',
  electronVersion: '33.0.2'
} +0ms
  electron-forge:packager targets: [ { platform: 'linux', arch: 'arm64' } ] +99ms
❯ Packaging for arm64 on linux
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
✔ Copying files
› gyp verb clean removing "build" directory
› gyp verb download using dist-url https://www.electronjs.org/headers
› gyp verb find Python checking Python explicitly set from command line or npm configuration
› gyp verb find Python - "--python=" or "npm config get python" is "/usr/bin/python3"
› gyp verb find Python - executing "/usr/bin/python3" to get executable path
› gyp sill find Python execFile: exec = "/usr/bin/python3"
› gyp sill find Python execFile: args = ["-c","import sys; sys.stdout.buffer.write(sys.executable.encode('utf-8'));"]
› gyp sill find Python execFile: opts = {"env":{"LESSOPEN":"| /usr/bin/lesspipe %s","npm_config_version_commit_hooks":"true","npm_config_user_agent":"yarn/1.22.22 npm/? node/v20.15.0 linux arm64","npm_package_devDependencies_uuid":"^10.0.0","npm_config_bin_links":"true","HOSTNAME":"8064c052a0ca","npm_node_execpath":"/root/.nvm/versions/node/v20.15.0/bin/node","npm_package_devDependencies_vite":"^5.4.0","npm_config_init_version":"1.0.0","DEBUG":"electron-forge:*","SHLVL":"1","npm_package_devDependencies__electron_forge_plugin_fuses":"^7.5.0","HOME":"/root","npm_package_devDependencies__eslint_js":"^9.8.0","NVM_BIN":"/root/.nvm/versions/node/v20.15.0/bin","NVM_INC":"/root/.nvm/versions/node/v20.15.0/include/node","npm_package_devDependencies__electron_forge_plugin_auto_unpack_natives":"^7.5.0","npm_config_init_license":"MIT","YARN_WRAP_OUTPUT":"false","npm_package_dependencies_fabric":"^6.4.3","npm_config_version_tag_prefix":"v","PS1":"(myenv) \\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ ","npm_package_devDependencies_eslint_plugin_react_hooks":"^5.1.0-rc.0","npm_package_devDependencies_typescript":"^5.5.3","npm_package_description":"healthmanage","NVM_DIR":"/root/.nvm","npm_package_readmeFilename":"README.md","npm_package_devDependencies__types_react_dom":"^18.3.0","npm_package_homepage":"http://.","npm_package_devDependencies__vitejs_plugin_react_swc":"^3.5.0","npm_package_devDependencies__electron_forge_maker_rpm":"^7.5.0","npm_package_scripts_dev":"vite","_":"/root/.nvm/versions/node/v20.15.0/bin/yarn","npm_package_devDependencies_postcss_pxtorem":"^6.1.0","npm_package_private":"true","npm_package_devDependencies__types_uuid":"^10","npm_package_devDependencies__electron_forge_maker_deb":"^7.5.0","npm_package_scripts_lint":"eslint .","npm_config_registry":"https://registry.npmmirror.com/","TERM":"dumb","npm_package_devDependencies__electron_forge_maker_zip":"^7.5.0","npm_package_devDependencies_eslint_plugin_react_refresh":"^0.4.9","npm_package_scripts_start":"electron-forge start","npm_config_ignore_scripts":"","npm_package_devDependencies__electron_forge_maker_squirrel":"^7.5.0","PATH":"/tmp/yarn--1730094392119-0.9028181527238561:/healthmanage/node_modules/.bin:/usr/local/share/.config/yarn/link/node_modules/.bin:/root/.nvm/versions/node/v20.15.0/libexec/lib/node_modules/npm/bin/node-gyp-bin:/root/.nvm/versions/node/v20.15.0/lib/node_modules/npm/bin/node-gyp-bin:/root/.nvm/versions/node/v20.15.0/bin/node_modules/npm/bin/node-gyp-bin:/root/myenv/bin:/usr/local/bin/python3:/root/.nvm/versions/node/v20.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NODE":"/root/.nvm/versions/node/v20.15.0/bin/node","npm_package_devDependencies_typescript_eslint":"^8.0.0","npm_package_scripts_make_debug":"DEBUG=electron-forge:* electron-forge make","npm_package_scripts_package":"electron-forge package","npm_package_name":"healthmanage","VIRTUAL_ENV_PROMPT":"(myenv) ","npm_package_devDependencies_eslint":"^9.8.0","npm_package_devDependencies__types_styled_components":"^5.1.34","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:","npm_lifecycle_script":"DEBUG=electron-forge:* electron-forge make","npm_package_main":"main.js","npm_config_version_git_message":"v%s","npm_lifecycle_event":"make-debug","npm_package_devDependencies__types_react":"^18.3.3","npm_package_version":"0.0.0","npm_config_argv":"{\"remain\":[],\"cooked\":[\"run\",\"make-debug\"],\"original\":[\"make-debug\"]}","npm_package_scripts_build":"vite build","LESSCLOSE":"/usr/bin/lesspipe %s %s","npm_package_devDependencies__types_postcss_pxtorem":"^6","npm_config_version_git_tag":"true","npm_config_version_git_sign":"","npm_package_devDependencies_globals":"^15.9.0","npm_package_devDependencies__electron_rebuild":"^3.7.0","npm_package_devDependencies__electron_forge_cli":"^7.5.0","npm_package_scripts_make":"electron-forge make","npm_package_license":"MIT","npm_config_strict_ssl":"true","VIRTUAL_ENV":"/root/myenv","PWD":"/healthmanage","npm_execpath":"/root/.nvm/versions/node/v20.15.0/lib/node_modules/yarn/bin/yarn.js","npm_package_devDependencies__electron_fuses":"^1.8.0","NVM_CD_FLAGS":"","npm_package_devDependencies_electron":"^33.0.0","npm_package_author_name":"HONGYAN","npm_package_devDependencies_postcss":"^8.4.41","npm_config_save_prefix":"^","npm_config_ignore_optional":"","npm_package_scripts_preview":"vite preview","npm_config_python":"/usr/bin/python3","INIT_CWD":"/healthmanage"},"shell":false}
› gyp sill find Python execFile result: err = null
› gyp sill find Python execFile result: stdout = "/usr/bin/python3"
› gyp sill find Python execFile result: stderr = ""
› gyp verb find Python - executable path is "/usr/bin/python3"
› gyp verb find Python - executing "/usr/bin/python3" to get version
› gyp sill find Python execFile: exec = "/usr/bin/python3"
› gyp sill find Python execFile: args = ["-c","import sys; print(\"%s.%s.%s\" % sys.version_info[:3]);"]
› gyp sill find Python execFile: opts = {"env":{"LESSOPEN":"| /usr/bin/lesspipe %s","npm_config_version_commit_hooks":"true","npm_config_user_agent":"yarn/1.22.22 npm/? node/v20.15.0 linux arm64","npm_package_devDependencies_uuid":"^10.0.0","npm_config_bin_links":"true","HOSTNAME":"8064c052a0ca","npm_node_execpath":"/root/.nvm/versions/node/v20.15.0/bin/node","npm_package_devDependencies_vite":"^5.4.0","npm_config_init_version":"1.0.0","DEBUG":"electron-forge:*","SHLVL":"1","npm_package_devDependencies__electron_forge_plugin_fuses":"^7.5.0","HOME":"/root","npm_package_devDependencies__eslint_js":"^9.8.0","NVM_BIN":"/root/.nvm/versions/node/v20.15.0/bin","NVM_INC":"/root/.nvm/versions/node/v20.15.0/include/node","npm_package_devDependencies__electron_forge_plugin_auto_unpack_natives":"^7.5.0","npm_config_init_license":"MIT","YARN_WRAP_OUTPUT":"false","npm_package_dependencies_fabric":"^6.4.3","npm_config_version_tag_prefix":"v","PS1":"(myenv) \\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ ","npm_package_devDependencies_eslint_plugin_react_hooks":"^5.1.0-rc.0","npm_package_devDependencies_typescript":"^5.5.3","npm_package_description":"healthmanage","NVM_DIR":"/root/.nvm","npm_package_readmeFilename":"README.md","npm_package_devDependencies__types_react_dom":"^18.3.0","npm_package_homepage":"http://.","npm_package_devDependencies__vitejs_plugin_react_swc":"^3.5.0","npm_package_devDependencies__electron_forge_maker_rpm":"^7.5.0","npm_package_scripts_dev":"vite","_":"/root/.nvm/versions/node/v20.15.0/bin/yarn","npm_package_devDependencies_postcss_pxtorem":"^6.1.0","npm_package_private":"true","npm_package_devDependencies__types_uuid":"^10","npm_package_devDependencies__electron_forge_maker_deb":"^7.5.0","npm_package_scripts_lint":"eslint .","npm_config_registry":"https://registry.npmmirror.com/","TERM":"dumb","npm_package_devDependencies__electron_forge_maker_zip":"^7.5.0","npm_package_devDependencies_eslint_plugin_react_refresh":"^0.4.9","npm_package_scripts_start":"electron-forge start","npm_config_ignore_scripts":"","npm_package_devDependencies__electron_forge_maker_squirrel":"^7.5.0","PATH":"/tmp/yarn--1730094392119-0.9028181527238561:/healthmanage/node_modules/.bin:/usr/local/share/.config/yarn/link/node_modules/.bin:/root/.nvm/versions/node/v20.15.0/libexec/lib/node_modules/npm/bin/node-gyp-bin:/root/.nvm/versions/node/v20.15.0/lib/node_modules/npm/bin/node-gyp-bin:/root/.nvm/versions/node/v20.15.0/bin/node_modules/npm/bin/node-gyp-bin:/root/myenv/bin:/usr/local/bin/python3:/root/.nvm/versions/node/v20.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NODE":"/root/.nvm/versions/node/v20.15.0/bin/node","npm_package_devDependencies_typescript_eslint":"^8.0.0","npm_package_scripts_make_debug":"DEBUG=electron-forge:* electron-forge make","npm_package_scripts_package":"electron-forge package","npm_package_name":"healthmanage","VIRTUAL_ENV_PROMPT":"(myenv) ","npm_package_devDependencies_eslint":"^9.8.0","npm_package_devDependencies__types_styled_components":"^5.1.34","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:","npm_lifecycle_script":"DEBUG=electron-forge:* electron-forge make","npm_package_main":"main.js","npm_config_version_git_message":"v%s","npm_lifecycle_event":"make-debug","npm_package_devDependencies__types_react":"^18.3.3","npm_package_version":"0.0.0","npm_config_argv":"{\"remain\":[],\"cooked\":[\"run\",\"make-debug\"],\"original\":[\"make-debug\"]}","npm_package_scripts_build":"vite build","LESSCLOSE":"/usr/bin/lesspipe %s %s","npm_package_devDependencies__types_postcss_pxtorem":"^6","npm_config_version_git_tag":"true","npm_config_version_git_sign":"","npm_package_devDependencies_globals":"^15.9.0","npm_package_devDependencies__electron_rebuild":"^3.7.0","npm_package_devDependencies__electron_forge_cli":"^7.5.0","npm_package_scripts_make":"electron-forge make","npm_package_license":"MIT","npm_config_strict_ssl":"true","VIRTUAL_ENV":"/root/myenv","PWD":"/healthmanage","npm_execpath":"/root/.nvm/versions/node/v20.15.0/lib/node_modules/yarn/bin/yarn.js","npm_package_devDependencies__electron_fuses":"^1.8.0","NVM_CD_FLAGS":"","npm_package_devDependencies_electron":"^33.0.0","npm_package_author_name":"HONGYAN","npm_package_devDependencies_postcss":"^8.4.41","npm_config_save_prefix":"^","npm_config_ignore_optional":"","npm_package_scripts_preview":"vite preview","npm_config_python":"/usr/bin/python3","INIT_CWD":"/healthmanage"},"shell":false}
› gyp sill find Python execFile result: err = null
› gyp sill find Python execFile result: stdout = "3.12.3\n"
› gyp sill find Python execFile result: stderr = ""
› gyp verb find Python - version is "3.12.3"
› gyp info find Python using Python version 3.12.3 found at "/usr/bin/python3"
› gyp verb get node dir compiling against --target node version: 33.0.2

› gyp verb download using dist-url https://www.electronjs.org/headers
› gyp verb install input version string "33.0.2"
› gyp verb install installing version: 33.0.2
› gyp verb install --ensure was passed, so won't reinstall if already installed
› gyp verb install version is already installed, need to check "installVersion"
› gyp verb got "installVersion" 11
› gyp verb needs "installVersion" 11
› gyp verb install version is good
› gyp verb get node dir target node version installed: 33.0.2
› gyp verb build dir attempting to create "build" dir: /tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build
› gyp verb build dir "build" dir needed to be created? Yes
› gyp verb build/config.gypi creating config file
› gyp sill build/config.gypi {
› gyp sill build/config.gypi target_defaults: {
› gyp sill build/config.gypi cflags: [],
› gyp sill build/config.gypi default_configuration: 'Release',
› gyp sill build/config.gypi defines: [],
› gyp sill build/config.gypi include_dirs: [],
› gyp sill build/config.gypi libraries: [],
› gyp sill build/config.gypi msvs_configuration_platform: 'ARM64',
› gyp sill build/config.gypi xcode_configuration_platform: 'arm64'
› gyp sill build/config.gypi },
› gyp sill build/config.gypi variables: {
› gyp sill build/config.gypi arm_fpu: 'neon',
› gyp sill build/config.gypi asan: 0,
› gyp sill build/config.gypi build_v8_with_gn: 'false',
› gyp sill build/config.gypi built_with_electron: 1,
› gyp sill build/config.gypi coverage: 'false',
› gyp sill build/config.gypi dcheck_always_on: 0,
› gyp sill build/config.gypi debug_nghttp2: 'false',
› gyp sill build/config.gypi debug_node: 'false',
› gyp sill build/config.gypi enable_lto: 'false',
› gyp sill build/config.gypi enable_pgo_generate: 'false',
› gyp sill build/config.gypi enable_pgo_use: 'false',
› gyp sill build/config.gypi error_on_warn: 'false',
› gyp sill build/config.gypi force_dynamic_crt: 0,
› gyp sill build/config.gypi host_arch: 'x64',
› gyp sill build/config.gypi icu_data_in: '..\\..\\deps\\icu-tmp\\icudt75l.dat',
› gyp sill build/config.gypi icu_endianness: 'l',
› gyp sill build/config.gypi icu_gyp_path: 'tools/icu/icu-generic.gyp',
› gyp sill build/config.gypi icu_path: 'deps/icu-small',
› gyp sill build/config.gypi icu_small: 'false',
› gyp sill build/config.gypi icu_ver_major: '75',
› gyp sill build/config.gypi is_debug: 0,
› gyp sill build/config.gypi libdir: 'lib',
› gyp sill build/config.gypi llvm_version: '0.0',
› gyp sill build/config.gypi napi_build_version: '9',
› gyp sill build/config.gypi node_builtin_shareable_builtins: [
› gyp sill build/config.gypi 'deps/cjs-module-lexer/lexer.js',
› gyp sill build/config.gypi 'deps/cjs-module-lexer/dist/lexer.js',
› gyp sill build/config.gypi 'deps/undici/undici.js'
› gyp sill build/config.gypi ],
› gyp sill build/config.gypi node_byteorder: 'little',
› gyp sill build/config.gypi node_debug_lib: 'false',
› gyp sill build/config.gypi node_enable_d8: 'false',
› gyp sill build/config.gypi node_enable_v8_vtunejit: 'false',
› gyp sill build/config.gypi node_fipsinstall: 'false',
› gyp sill build/config.gypi node_install_corepack: 'true',
› gyp sill build/config.gypi node_install_npm: 'true',
› gyp sill build/config.gypi node_library_files: [
› gyp sill build/config.gypi 'lib/_http_agent.js',
› gyp sill build/config.gypi 'lib/_http_client.js',
› gyp sill build/config.gypi 'lib/_http_common.js',
› gyp sill build/config.gypi 'lib/_http_incoming.js',
› gyp sill build/config.gypi 'lib/_http_outgoing.js',
› gyp sill build/config.gypi 'lib/_http_server.js',
› gyp sill build/config.gypi 'lib/_stream_duplex.js',
› gyp sill build/config.gypi 'lib/_stream_passthrough.js',
› gyp sill build/config.gypi 'lib/_stream_readable.js',
› gyp sill build/config.gypi 'lib/_stream_transform.js',
› gyp sill build/config.gypi 'lib/_stream_wrap.js',
› gyp sill build/config.gypi 'lib/_stream_writable.js',
› gyp sill build/config.gypi 'lib/_tls_common.js',
› gyp sill build/config.gypi 'lib/_tls_wrap.js',
› gyp sill build/config.gypi 'lib/assert.js',
› gyp sill build/config.gypi 'lib/assert/strict.js',
› gyp sill build/config.gypi 'lib/async_hooks.js',
› gyp sill build/config.gypi 'lib/buffer.js',
› gyp sill build/config.gypi 'lib/child_process.js',
› gyp sill build/config.gypi 'lib/cluster.js',
› gyp sill build/config.gypi 'lib/console.js',
› gyp sill build/config.gypi 'lib/constants.js',
› gyp sill build/config.gypi 'lib/crypto.js',
› gyp sill build/config.gypi 'lib/dgram.js',
› gyp sill build/config.gypi 'lib/diagnostics_channel.js',
› gyp sill build/config.gypi 'lib/dns.js',
› gyp sill build/config.gypi 'lib/dns/promises.js',
› gyp sill build/config.gypi 'lib/domain.js',
› gyp sill build/config.gypi 'lib/events.js',
› gyp sill build/config.gypi 'lib/fs.js',
› gyp sill build/config.gypi 'lib/fs/promises.js',
› gyp sill build/config.gypi 'lib/http.js',
› gyp sill build/config.gypi 'lib/http2.js',
› gyp sill build/config.gypi 'lib/https.js',
› gyp sill build/config.gypi 'lib/inspector.js',
› gyp sill build/config.gypi 'lib/inspector/promises.js',
› gyp sill build/config.gypi 'lib/internal/abort_controller.js',
› gyp sill build/config.gypi 'lib/internal/assert.js',
› gyp sill build/config.gypi 'lib/internal/assert/assertion_error.js',
› gyp sill build/config.gypi 'lib/internal/assert/calltracker.js',
› gyp sill build/config.gypi 'lib/internal/assert/utils.js',
› gyp sill build/config.gypi 'lib/internal/async_hooks.js',
› gyp sill build/config.gypi 'lib/internal/blob.js',
› gyp sill build/config.gypi 'lib/internal/blocklist.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/node.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/realm.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/shadow_realm.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/switches/does_not_own_process_state.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/switches/does_own_process_state.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/switches/is_main_thread.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/switches/is_not_main_thread.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/web/exposed-wildcard.js',
› gyp sill build/config.gypi 'lib/internal/bootstrap/web/exposed-window-or-worker.js',
› gyp sill build/config.gypi 'lib/internal/buffer.js',
› gyp sill build/config.gypi 'lib/internal/child_process.js',
› gyp sill build/config.gypi 'lib/internal/child_process/serialization.js',
› gyp sill build/config.gypi 'lib/internal/cli_table.js',
› gyp sill build/config.gypi 'lib/internal/cluster/child.js',
› gyp sill build/config.gypi 'lib/internal/cluster/primary.js',
› gyp sill build/config.gypi 'lib/internal/cluster/round_robin_handle.js',
› gyp sill build/config.gypi 'lib/internal/cluster/shared_handle.js',
› gyp sill build/config.gypi 'lib/internal/cluster/utils.js',
› gyp sill build/config.gypi 'lib/internal/cluster/worker.js',
› gyp sill build/config.gypi 'lib/internal/console/constructor.js',
› gyp sill build/config.gypi 'lib/internal/console/global.js',
› gyp sill build/config.gypi 'lib/internal/constants.js',
› gyp sill build/config.gypi 'lib/internal/crypto/aes.js',
› gyp sill build/config.gypi 'lib/internal/crypto/certificate.js',
› gyp sill build/config.gypi 'lib/internal/crypto/cfrg.js',
› gyp sill build/config.gypi 'lib/internal/crypto/cipher.js',
› gyp sill build/config.gypi 'lib/internal/crypto/diffiehellman.js',
› gyp sill build/config.gypi 'lib/internal/crypto/ec.js',
› gyp sill build/config.gypi 'lib/internal/crypto/hash.js',
› gyp sill build/config.gypi 'lib/internal/crypto/hashnames.js',
› gyp sill build/config.gypi 'lib/internal/crypto/hkdf.js',
› gyp sill build/config.gypi 'lib/internal/crypto/keygen.js',
› gyp sill build/config.gypi 'lib/internal/crypto/keys.js',
› gyp sill build/config.gypi 'lib/internal/crypto/mac.js',
› gyp sill build/config.gypi 'lib/internal/crypto/pbkdf2.js',
› gyp sill build/config.gypi 'lib/internal/crypto/random.js',
› gyp sill build/config.gypi 'lib/internal/crypto/rsa.js',
› gyp sill build/config.gypi 'lib/internal/crypto/scrypt.js',
› gyp sill build/config.gypi 'lib/internal/crypto/sig.js',
› gyp sill build/config.gypi 'lib/internal/crypto/util.js',
› gyp sill build/config.gypi 'lib/internal/crypto/webcrypto.js',
› gyp sill build/config.gypi 'lib/internal/crypto/webidl.js',
› gyp sill build/config.gypi 'lib/internal/crypto/x509.js',
› gyp sill build/config.gypi 'lib/internal/debugger/inspect.js',
› gyp sill build/config.gypi 'lib/internal/debugger/inspect_client.js',
› gyp sill build/config.gypi 'lib/internal/debugger/inspect_repl.js',
› gyp sill build/config.gypi 'lib/internal/dgram.js',
› gyp sill build/config.gypi 'lib/internal/dns/callback_resolver.js',
› gyp sill build/config.gypi 'lib/internal/dns/promises.js',
› gyp sill build/config.gypi 'lib/internal/dns/utils.js',
› gyp sill build/config.gypi 'lib/internal/encoding.js',
› gyp sill build/config.gypi 'lib/internal/error_serdes.js',
› gyp sill build/config.gypi 'lib/internal/errors.js',
› gyp sill build/config.gypi 'lib/internal/event_target.js',
› gyp sill build/config.gypi 'lib/internal/events/abort_listener.js',
› gyp sill build/config.gypi 'lib/internal/events/symbols.js',
› gyp sill build/config.gypi ... 219 more items
› gyp sill build/config.gypi ],
› gyp sill build/config.gypi node_module_version: 130,
› gyp sill build/config.gypi node_no_browser_globals: 'false',
› gyp sill build/config.gypi node_prefix: '\\usr\\local',
› gyp sill build/config.gypi node_release_urlbase: '',
› gyp sill build/config.gypi node_shared: 'false',
› gyp sill build/config.gypi node_shared_ada: 'false',
› gyp sill build/config.gypi node_shared_brotli: 'false',
› gyp sill build/config.gypi node_shared_cares: 'false',
› gyp sill build/config.gypi node_shared_http_parser: 'false',
› gyp sill build/config.gypi node_shared_libuv: 'false',
› gyp sill build/config.gypi node_shared_nghttp2: 'false',
› gyp sill build/config.gypi node_shared_nghttp3: 'false',
› gyp sill build/config.gypi node_shared_ngtcp2: 'false',
› gyp sill build/config.gypi node_shared_openssl: 'false',
› gyp sill build/config.gypi node_shared_simdjson: 'false',
› gyp sill build/config.gypi node_shared_simdutf: 'false',
› gyp sill build/config.gypi node_shared_uvwasi: 'false',
› gyp sill build/config.gypi node_shared_zlib: 'false',
› gyp sill build/config.gypi node_tag: '',
› gyp sill build/config.gypi node_target_type: 'executable',
› gyp sill build/config.gypi node_use_bundled_v8: 'true',
› gyp sill build/config.gypi node_use_node_code_cache: 'false',
› gyp sill build/config.gypi node_use_node_snapshot: 'false',
› gyp sill build/config.gypi node_use_openssl: 'true',
› gyp sill build/config.gypi node_use_v8_platform: 'true',
› gyp sill build/config.gypi node_with_ltcg: 'true',
› gyp sill build/config.gypi node_without_node_options: 'false',
› gyp sill build/config.gypi node_write_snapshot_as_array_literals: 'true',
› gyp sill build/config.gypi openssl_is_fips: 'false',
› gyp sill build/config.gypi openssl_no_asm: 1,
› gyp sill build/config.gypi openssl_quic: 'true',
› gyp sill build/config.gypi ossfuzz: 'false',
› gyp sill build/config.gypi shlib_suffix: 'so.115',
› gyp sill build/config.gypi single_executable_application: 'true',
› gyp sill build/config.gypi target_arch: 'arm64',
› gyp sill build/config.gypi ubsan: 0,
› gyp sill build/config.gypi use_prefix_to_find_headers: 'false',
› gyp sill build/config.gypi using_electron_config_gypi: 1,
› gyp sill build/config.gypi v8_enable_31bit_smis_on_64bit_arch: 1,
› gyp sill build/config.gypi v8_enable_extensible_ro_snapshot: 0,
› gyp sill build/config.gypi v8_enable_gdbjit: 0,
› gyp sill build/config.gypi v8_enable_hugepage: 0,
› gyp sill build/config.gypi v8_enable_i18n_support: 1,
› gyp sill build/config.gypi v8_enable_inspector: 1,
› gyp sill build/config.gypi v8_enable_javascript_promise_hooks: 1,
› gyp sill build/config.gypi v8_enable_lite_mode: 0,
› gyp sill build/config.gypi v8_enable_maglev: 0,
› gyp sill build/config.gypi v8_enable_object_print: 1,
› gyp sill build/config.gypi v8_enable_pointer_compression: 1,
› gyp sill build/config.gypi v8_enable_sandbox: 1,
› gyp sill build/config.gypi v8_enable_shared_ro_heap: 0,
› gyp sill build/config.gypi v8_enable_v8_checks: 0,
› gyp sill build/config.gypi v8_enable_webassembly: 1,
› gyp sill build/config.gypi v8_no_strict_aliasing: 1,
› gyp sill build/config.gypi v8_optimized_debug: 1,
› gyp sill build/config.gypi v8_promise_internal_field_count: 1,
› gyp sill build/config.gypi v8_random_seed: 0,
› gyp sill build/config.gypi v8_trace_maps: 0,
› gyp sill build/config.gypi v8_use_siphash: 1,
› gyp sill build/config.gypi want_separate_host_toolset: 1,
› gyp sill build/config.gypi nodedir: '/root/.electron-gyp/33.0.2',
› gyp sill build/config.gypi python: '/usr/bin/python3',
› gyp sill build/config.gypi standalone_static_library: 1,
› gyp sill build/config.gypi runtime: 'electron',
› gyp sill build/config.gypi target: '33.0.2',
› gyp sill build/config.gypi build_from_source: true,
› gyp sill build/config.gypi module_name: 'canvas',
› gyp sill build/config.gypi module_path: '/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build/Release',
› gyp sill build/config.gypi host: 'https://github.com/Automattic/node-canvas/releases/download/',
› gyp sill build/config.gypi remote_path: 'v2.11.2',
› gyp sill build/config.gypi package_name: 'canvas-v2.11.2-electron-v33.0-linux-glibc-arm64.tar.gz',
› gyp sill build/config.gypi version_commit_hooks: 'true',
› gyp sill build/config.gypi user_agent: 'yarn/1.22.22 npm/? node/v20.15.0 linux arm64',
› gyp sill build/config.gypi bin_links: 'true',
› gyp sill build/config.gypi init_version: '1.0.0',
› gyp sill build/config.gypi init_license: 'MIT',
› gyp sill build/config.gypi version_tag_prefix: 'v',
› gyp sill build/config.gypi registry: 'https://registry.npmmirror.com/',
› gyp sill build/config.gypi ignore_scripts: '',
› gyp sill build/config.gypi version_git_message: 'v%s',
› gyp sill build/config.gypi version_git_tag: 'true',
› gyp sill build/config.gypi version_git_sign: '',
› gyp sill build/config.gypi strict_ssl: 'true',
› gyp sill build/config.gypi save_prefix: '^',
› gyp sill build/config.gypi ignore_optional: ''
› gyp sill build/config.gypi }
› gyp sill build/config.gypi }
› gyp verb build/config.gypi writing out config file: /tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build/config.gypi
› gyp verb config.gypi checking for gypi file: /tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/config.gypi
› gyp verb common.gypi checking for gypi file: /tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/common.gypi
› gyp verb gyp gyp format was not specified; forcing "make"
› gyp info spawn /usr/bin/python3
› gyp info spawn args [
› gyp info spawn args '/healthmanage/node_modules/@electron/node-gyp/gyp/gyp_main.py',
› gyp info spawn args 'binding.gyp',
› gyp info spawn args '-f',
› gyp info spawn args 'make',
› gyp info spawn args '-I',
› gyp info spawn args '/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build/config.gypi',
› gyp info spawn args '-I',
› gyp info spawn args '/healthmanage/node_modules/@electron/node-gyp/addon.gypi',
› gyp info spawn args '-I',
› gyp info spawn args '/root/.electron-gyp/33.0.2/include/node/common.gypi',
› gyp info spawn args '-Dlibrary=shared_library',
› gyp info spawn args '-Dvisibility=default',
› gyp info spawn args '-Dnode_root_dir=/root/.electron-gyp/33.0.2',
› gyp info spawn args '-Dnode_gyp_dir=/healthmanage/node_modules/@electron/node-gyp',
› gyp info spawn args '-Dnode_lib_file=/root/.electron-gyp/33.0.2/<(target_arch)/node.lib',
› gyp info spawn args '-Dmodule_root_dir=/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas',
› gyp info spawn args '-Dnode_engine=v8',
› gyp info spawn args '--depth=.',
› gyp info spawn args '--no-parallel',
› gyp info spawn args '--generator-output',
› gyp info spawn args 'build',
› gyp info spawn args '-Goutput_dir=.'
› gyp info spawn args ]
› gyp verb build type Release
› gyp verb architecture arm64
› gyp verb node dev dir /root/.electron-gyp/33.0.2
› gyp verb python /usr/bin/python3
› gyp verb `which` succeeded for `make` /usr/bin/make
› gyp verb bin symlinks created symlink to "/usr/bin/python3" in "/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build/node_gyp_bins" and added to PATH
› gyp info spawn make
› gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
› make: Entering directory '/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build'
›   g++ -o Release/obj.target/canvas-postbuild.node -shared -pthread -rdynamic  -Wl,-soname=canvas-postbuild.node -Wl,--start-group  -Wl,--end-group
›   ln -f "Release/obj.target/canvas-postbuild.node" "Release/canvas-postbuild.node" 2>/dev/null || (rm -rf "Release/canvas-postbuild.node" && cp -af "Release/obj.target/canvas-postbuild.node" "Release/canvas-postbuild.node")
› make: *** No rule to make target 'Release/obj.target/canvas/src/backend/Backend.o', needed by 'Release/obj.target/canvas.node'.  Stop.
› make: Leaving directory '/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas/build'
› Error: `make` failed with exit code: 2
›     at ChildProcess.<anonymous> (/healthmanage/node_modules/@electron/node-gyp/lib/build.js:215:23)

An unhandled rejection has occurred inside Forge:
Error: node-gyp failed to rebuild '/tmp/electron-packager/tmp-vjajnS/resources/app/node_modules/canvas'
at ChildProcess.<anonymous> (/healthmanage/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js:121:24)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
asturur commented 1 month ago

you are on arm64 and you are compiling canvas node module. Can you compile it outside this build process?

https://github.com/Automattic/node-canvas

Try to compile version 2.11.2 ( latest release ) outside this electron process first and see if you can succeed.

pengrun commented 1 month ago

you are on arm64 and you are compiling canvas node module. Can you compile it outside this build process?

https://github.com/Automattic/node-canvas

Try to compile version 2.11.2 ( latest release ) outside this electron process first and see if you can succeed.

First of all, thank you for your reply.

I have already used the latest version of node canvas. When adding fabric.js,electron forcealways fails to build. However, if I remove fabric.jsand add other canvas dependencies (such as@cyntler/react-doc-viewer) image

electron forcecan be built normally. At the same time, I replaced the previous only Fabric. js dependency with @cyntler/react-doc-viewer": "^1.17.0. After that, electroncan be built. image

By querying yarn. lock, I found that@cyntler/react-doc-viewer": "^1.17.0refers topdfjs-dist@4.4.168The corresponding node in optionalDependencies is 2.11.2. image

当然,我期间都执行了以下命令:

rm -rf node_modules/
yarn.lock
yarn install