Electron打包问题
跳到导航
跳到搜索
electron-builder version=22.9.1 os=10.0.19041 • loaded configuration file=package.json ("build" field) • electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json` • writing effective config file=build\builder-effective-config.yaml • rebuilding native dependencies dependencies=@serialport/bindings@9.0.3 platform=win32 arch=x64 • install prebuilt binary name=@serialport/bindings version=9.0.3 platform=win32 arch=x64 • build native dependency from sources name=@serialport/bindings version=9.0.3 platform=win32 arch=x64 reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information) error=prebuild-install info begin Prebuild-install version 6.0.0 prebuild-install WARN install prebuilt binaries enforced with --force! prebuild-install WARN install prebuilt binaries may be out of date! prebuild-install info looking for cached prebuild @ C:\Users\XXX\AppData\Local\npm-cache\_prebuilds\ffa09e-bindings-v9.0.3-electron-v80-win32-x64.tar.gz prebuild-install http request GET https://github.com/serialport/node-serialport/releases/download/@serialport/bindings@9.0.3/bindings-v9.0.3-electron-v80-win32-x64.tar.gz prebuild-install WARN install getaddrinfo ENOTFOUND github.com ⨯ cannot execute cause=exit status 1 out= > @serialport/bindings@9.0.3 install F:\git-program\electron-vue-serialport-master\node_modules\@serialport\bindings > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild F:\git-program\electron-vue-serialport-master\node_modules\@serialport\bindings>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) errorOut=prebuild-install WARN install getaddrinfo ENOTFOUND github.com gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad gyp ERR! stack network settings. gyp ERR! stack at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:171:21) gyp ERR! stack at Request.emit (events.js:314:20) gyp ERR! stack at Request.onRequestError (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:881:8) gyp ERR! stack at ClientRequest.emit (events.js:314:20) gyp ERR! stack at TLSSocket.socketErrorListener (_http_client.js:469:9) gyp ERR! stack at TLSSocket.emit (events.js:314:20) gyp ERR! stack at emitErrorNT (internal/streams/destroy.js:106:8) gyp ERR! stack at emitErrorCloseNT (internal/streams/destroy.js:74:3) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21) gyp ERR! System Windows_NT 10.0.19041 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd F:\git-program\electron-vue-serialport-master\node_modules\@serialport\bindings gyp ERR! node -v v14.12.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @serialport/bindings@9.0.3 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @serialport/bindings@9.0.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\XXX\AppData\Local\npm-cache\_logs\2020-12-10T14_38_55_357Z-debug.log command='C:\Program Files\nodejs\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' rebuild @serialport/bindings@9.0.3 workingDir=
联机模式
修改.npmrc配置文件
better_sqlite3_binary_host=https://registry.npmmirror.com/-/binary/better-sqlite3 better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3 better-sqlite3_binary_host=https://registry.npmmirror.com/-/binary/better-sqlite3 better-sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3
离线模式
将联机模式下的C:\Users\XXX\AppData\Local\npm-cache\_prebuilds目录打包移至离线模式对应目录。