admin管理员组

文章数量:1289879

I have integrated SQLite3 into my project, which I developed using Electron and React. Everything works perfectly in the development environment. However, when I move the project to the production environment, I encounter an error related to SQLite3. The database is installed and running on the environment where I run the project, so I don’t understand why this error occurs.

I’m sharing some code examples below. Could you help me figure this out?

sqllite.js

import sqllite3 from 'sqlite3'
const userDataPath = app.getPath('userData')
this.sql = new sqllite3.Database(`${userDataPath}/database.db`, (error, database) => { .. bla bla .. })

package.json

"sqlite3": "^5.1.7"

main/index.js

webPreferences: {
    preload: path.join(__dirname, "../preload/index.js"),
    sandbox: false,
    nodeIntegration: true,
    contextIsolation: false
 }

error

A JavaScript error occurred in the main process

Uncaught Exception:
Error: dlopen(/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu, 0x0001): tried: '/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (code signature in <CFB61DC4-0D6B-3B10-BE39-1944935AB942> '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (no such file), '/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (code signature in <CFB61DC4-0D6B-3B10-BE39-1944935AB942> '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (code signature in <CFB61DC4-0D6B-3B10-BE39-1944935AB942> '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (no such file), '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' (code signature in <CFB61DC4-0D6B-3B10-BE39-1944935AB942> '/private/var/folders/g7/j3pbhgyj7gv4dhlyjsz162br0000gn/T/.electron.app.Mwp2Qu' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)
at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
at Module._extensions..node (node:internal/modules/cjs/loader:1602:18)
at Object.func [as .node] (node:electron/js2c/node_init:2:2786)
at Module.load (node:internal/modules/cjs/loader:1295:32)
at Module._load (node:internal/modules/cjs/loader:1111:12)
at c._load (node:electron/js2c/node_init:2:16955)
at Module.require (node:internal/modules/cjs/loader:1318:19)
at require (node:internal/modules/helpers:179:18)
at bindings (/Users/ugurcanalyuz/Projects/kaffee-schutz-desktop/dist/mac-arm64/KFSPos.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/Users/ugurcanalyuz/Projects/kaffee-schutz-desktop/dist/mac-arm64/KFSPos.app/Contents/Resources/app.asar/node_modules/sqlite3/lib/sqlite3-binding.js:1:37)

本文标签: