在M芯片macOS环境下从源代码build MQTT X出现错误

执行 yarn run electron:build 命令后出现错误,错误如下:

• Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • rebuilding native dependencies  dependencies=sqlite3@5.1.5 platform=linux arch=x64
  • rebuilding native dependency  name=sqlite3 version=5.1.5
  ⨯ cannot execute  cause=exit status 1
$ node-pre-gyp install --fallback-to-build
    Failed to execute '/opt/homebrew/Cellar/node/19.8.1/bin/node /Users/richardmac/Documents/GitHub/MQTTX/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/richardmac/Documents/GitHub/MQTTX/node_modules/sqlite3/lib/binding/napi-v6-linux-unknown-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/richardmac/Documents/GitHub/MQTTX/node_modules/sqlite3/lib/binding/napi-v6-linux-unknown-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    
                    errorOut=node-pre-gyp info it worked if it ends with ok
    node-pre-gyp info using node-pre-gyp@1.0.9
    node-pre-gyp info using node@19.8.1 | darwin | arm64
    node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.5/napi-v6-linux-unknown-x64.tar.gz
    node-pre-gyp ERR! install response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.5/napi-v6-linux-unknown-x64.tar.gz 
    node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.5 and electron@13.6.6 (electron-v13.6 ABI, unknown) (falling back to source compile with node-gyp) 
    node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.5/napi-v6-linux-unknown-x64.tar.gz

检查 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.5/napi-v6-linux-unknown-x64.tar.gz url,得到的是404 not found 的回应。

请各位协助处理该问题,谢谢。

您好,这边建议您先尝试使用不同的操作系统的 build 命令试一下:

# For Windows
yarn run electron:build-win

# For Linux
yarn run electron:build-linux

# For macOS
yarn run electron:build-mac

具体的报错原因我们再详细排查下,目前针对 M1 的 mac dev 还有 build 还有一些问题,建议在对应的操作系统上进行 build,如果上述命令出现问题,可以针对报错信息再处理。

1 个赞

执行 yarn run electron:build-mac 后解决问题,谢谢。