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

When running the packaged app that uses SQLite3 in Electron, the following error is prompted. #5501

Open
cnTrent opened this issue Mar 2, 2023 · 0 comments

Comments

@cnTrent
Copy link

cnTrent commented Mar 2, 2023

Environment

Knex version:2.4.2
Database + version: sqlite3@5.0.11
OS:win

Bug

error keno:run rpm install sqlite3 --save
rip-web package.json is not node-pre-gyp ready" package.json must declare these properties binary

This is my code
function initCache() {
const knexInstance = knex({
client: "sqlite3",
useNullAsDefault: true,
connection: {
filename: path.join(app.getPath("userData"), "local.db"),
},
});
/**

  • @Descripttion: 创建一个收获工作台的表
  • @test: test font
  • @msg:
  • @return {*}
    /
    ipcMain.handle("createWorktable", async (_, name) => {
    try {
    await knexInstance.schema.createTable(name, (table) => {
    table.increments("id");
    table.string("box_name");
    });
    return "创建成功";
    } catch (err) {
    return "已经存在收货工作台的表了";
    }
    });
    /
    *
  • @Descripttion: 往某一张表里插入数据
  • @test: test font
  • @msg:
  • @return {*}
    */

ipcMain.handle("insertTable", async (_, name, data) => {
await knexInstance(name).insert({ box_name: data });
});
/**

  • @Descripttion: 查找某一个表的所有的数据
  • @test: test font
  • @msg:
  • @return {*}
    /
    ipcMain.handle("allChatSelect", async (_, name, data) => {
    return await knexInstance(name).select("
    ");
    });
    }

When I ran it locally, there was no problem, but when I ran it packaged as an app, there was this error above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant