1.edit .npmrc
file(ref:https://www.electron.build/index.html#note-for-pnpm):
node-linker=hoisted
public-hoist-pattern=*
shamefully-hoist=true
fix: path too long! use short path
PS F:\t\db_test> pnpm build
> [email protected] build F:\t\db_test
> electron-builder
• electron-builder version=23.6.0 os=10.0.19044
• loaded configuration file=package.json ("build" field)
rch=x64
⨯ cannot execute cause=fork/exec C:\Users\Administrator\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs: %1 is not a valid Win32 application.
command='C:\Users\Administrator\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs' rebuild [email protected]
workingDir=
ELIFECYCLE Command failed with exit code 1.
PS F:\t\db_test>
fix :(ref: electron-userland/electron-builder#6933 (comment)): open file
C:\Users\Administrator\AppData\Local\pnpm\global\5\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs
, replace#!/usr/bin/env node
with#!node
note: use
const sqlite3 = require('sqlite3')
, noimport sqlite3 from 'sqlite3'