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

electron:build时报错 #1825

Closed
Ryan-CW-Code opened this issue Dec 6, 2024 · 2 comments
Closed

electron:build时报错 #1825

Ryan-CW-Code opened this issue Dec 6, 2024 · 2 comments
Assignees
Labels
desktop MQTTX Desktop help wanted Extra attention is needed
Milestone

Comments

@Ryan-CW-Code
Copy link

看起来不只是404报错,这是我第一次使用electron,期待得到您的帮助。

 INFO  Building app with electron-builder:
  • electron-builder  version=23.0.2 os=10.0.22631
  • writing effective config  file=dist_electron\builder-effective-config.yaml
  • rebuilding native dependencies  [email protected] platform=win32 arch=x64
  • rebuilding native dependency  name=sqlite3 version=5.0.4
  • packaging       platform=win32 arch=x64 electron=13.6.6 appOutDir=dist_electron\win-unpacked
  • rebuilding native dependencies  [email protected] platform=win32 arch=ia32
  • rebuilding native dependency  name=sqlite3 version=5.0.4
  • packaging       platform=win32 arch=ia32 electron=13.6.6 appOutDir=dist_electron\win-ia32-unpacked
  • rebuilding native dependencies  [email protected] platform=win32 arch=arm64
  • rebuilding native dependency  name=sqlite3 version=5.0.4
  ⨯ cannot execute  cause=exit status 1
                    out=

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for v143 (Platform Toolset = 'v143') cannot be found. To build using the v143 build tools, please install v143 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [E:\edge\MQTTX\node_modules\sqlite3\node-addon-api\nothing.vcxproj]
    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for v143 (Platform Toolset = 'v143') cannot be found. To build using the v143 build tools, please install v143 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [E:\edge\MQTTX\node_modules\sqlite3\build\deps\action_before_build.vcxproj]
    Failed to execute 'C:\Users\18319\AppData\Local\Volta\tools\image\node\16.20.2\node.exe E:\edge\MQTTX\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=E:\edge\MQTTX\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-arm64\node_sqlite3.node --module_name=node_sqlite3 --module_path=E:\edge\MQTTX\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)

                    errorOut=node-pre-gyp info it worked if it ends with ok
    node-pre-gyp info using [email protected]
    node-pre-gyp info using [email protected] | win32 | x64
    node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.4/napi-v6-win32-unknown-arm64.tar.gz
    node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.4/napi-v6-win32-unknown-arm64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443
    node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (electron-v13.6 ABI, unknown) (falling back to source compile with node-gyp)
    node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.4/napi-v6-win32-unknown-arm64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443
    gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | win32 | x64
    gyp info ok
    gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | win32 | x64
    gyp info find Python using Python version 3.12.8 found at "C:\Users\18319\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe"
    gyp info find VS using VS2022 (17.11.35303.130) found at:
    gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
    gyp info find VS run with --verbose for detailed information
    gyp info spawn C:\Users\18319\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe
    gyp info spawn args [
    gyp info spawn args 'E:\\edge\\MQTTX\\node_modules\\node-gyp\\gyp\\gyp_main.py',
    gyp info spawn args 'binding.gyp',
    gyp info spawn args '-f',
    gyp info spawn args 'msvs',
    gyp info spawn args '-I',
    gyp info spawn args 'E:\\edge\\MQTTX\\node_modules\\sqlite3\\build\\config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'E:\\edge\\MQTTX\\node_modules\\node-gyp\\addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\\Users\\18319\\.electron-gyp\\13.6.6\\include\\node\\common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=C:\\Users\\18319\\.electron-gyp\\13.6.6',
    gyp info spawn args '-Dnode_gyp_dir=E:\\edge\\MQTTX\\node_modules\\node-gyp',
    gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\18319\\\\.electron-gyp\\\\13.6.6\\\\<(target_arch)\\\\node.lib',
    gyp info spawn args '-Dmodule_root_dir=E:\\edge\\MQTTX\\node_modules\\sqlite3',
    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 'E:\\edge\\MQTTX\\node_modules\\sqlite3\\build',
    gyp info spawn args '-Goutput_dir=.'
    gyp info spawn args ]
    gyp info ok
    gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | win32 | x64
    gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
    gyp info spawn args [
    gyp info spawn args 'build\\binding.sln',
    gyp info spawn args '/clp:Verbosity=minimal',
    gyp info spawn args '/nologo',
    gyp info spawn args '/p:Configuration=Release;Platform=ARM64'
    gyp info spawn args ]
    gyp ERR! build error
    gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
    gyp ERR! stack at ChildProcess.<anonymous> (E:\edge\MQTTX\node_modules\node-gyp\lib\build.js:216:23)
    gyp ERR! stack at ChildProcess.emit (node:events:513:28)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
    gyp ERR! System Windows_NT 10.0.22631
    gyp ERR! command "C:\\Users\\18319\\AppData\\Local\\Volta\\tools\\image\\node\\16.20.2\\node.exe" "E:\\edge\\MQTTX\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=E:\\edge\\MQTTX\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-arm64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=E:\\edge\\MQTTX\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
    gyp ERR! cwd E:\edge\MQTTX\node_modules\sqlite3
    gyp ERR! node -v v16.20.2
    gyp ERR! node-gyp -v v11.0.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute 'C:\Users\18319\AppData\Local\Volta\tools\image\node\16.20.2\node.exe E:\edge\MQTTX\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=E:\edge\MQTTX\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-arm64\node_sqlite3.node --module_name=node_sqlite3 --module_path=E:\edge\MQTTX\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (E:\edge\MQTTX\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
    node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    node-pre-gyp ERR! System Windows_NT 10.0.22631
    node-pre-gyp ERR! command "C:\\Users\\18319\\AppData\\Local\\Volta\\tools\\image\\node\\16.20.2\\node.exe" "E:\\edge\\MQTTX\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd E:\edge\MQTTX\node_modules\sqlite3
    node-pre-gyp ERR! node -v v16.20.2
    node-pre-gyp ERR! node-pre-gyp -v v1.0.9
    node-pre-gyp ERR! not ok

                    command='C:\Users\18319\AppData\Local\Temp\xfs-7b6e5c52\yarn' run install
                    workingDir=E:\edge\MQTTX\node_modules\sqlite3
ExecError: E:\edge\MQTTX\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
2
    at ChildProcess.<anonymous> (E:\edge\MQTTX\node_modules\builder-util\src\util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.cp.emit (E:\edge\MQTTX\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  exitCode: 2,
  alreadyLogged: true,
  code: 'ERR_ELECTRON_BUILDER_CANNOT_EXECUTE'
}
@Ryan-CW-Code Ryan-CW-Code added the bug Something isn't working label Dec 6, 2024
@github-project-automation github-project-automation bot moved this to Backlog in MQTTX Dec 6, 2024
@ysfscream ysfscream self-assigned this Dec 9, 2024
@ysfscream ysfscream added help wanted Extra attention is needed desktop MQTTX Desktop labels Dec 9, 2024
@ysfscream ysfscream added this to the v1.11.1 milestone Dec 9, 2024
@ysfscream
Copy link
Member

Hi! Let me help you understand and address this error, although I should mention that I'm also not deeply familiar with this Electron build issue on Windows. However, I can suggest some potential solutions based on the error message:

The main error seems to be related to missing Visual Studio 2022 build tools (v143). Here's what we can try:

  1. First, open Visual Studio Installer (you can search for it in the Windows Start menu)

  2. When it opens:

    • Find Visual Studio 2022
    • Click "Modify"
    • Check "Desktop development with C++"
    • Make sure "MSVC v143 - VS 2022 C++ x64/x86 build tools" is selected in the right panel
  3. After installation completes, you might need to run:

npm install --global --production windows-build-tools
npm install --global node-gyp

# Then clean and rebuild your project
yarn run clean
yarn install
yarn electron:build-win

@ysfscream ysfscream removed the bug Something isn't working label Dec 10, 2024
@ysfscream ysfscream modified the milestones: v1.11.1, v1.12.0 Dec 16, 2024
@Ryan-CW-Code
Copy link
Author

同事用win10系统编译成功了

@github-project-automation github-project-automation bot moved this from Backlog to Done in MQTTX Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop MQTTX Desktop help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

2 participants