zoukankan      html  css  js  c++  java
  • electron安装sqlite3

    By far the easiest way to use SQLite with electron is with electron-builder.

    First, add a postinstall step in your package.json:

    "scripts": {
       "postinstall": "install-app-deps"
       ...
    }
    

    and then install the necessary dependencies and build:

    npm install --save-dev electron-builder
    npm install --save sqlite3
    npm run postinstall
    

    electron-builder will build the native module for your platform, with the correct name for the Electron binding; and you can then require it in code as normal.

    前面已经描述的很好,这么干的原因是,你通过npm install sqlite3安装的sqlite3是node的支持,不支持electron,要重新编译一个electron的版本。
    在做这个之前,要把window平台的编译支持安装上。

    下面是通用做法

    1.安装window下的c++编译支持
    2.安装electron-builder,
    3.安装sqlite3.
    4重新编译electron支持的sqlite3

    第4步可以使用npm install安装所有依赖时触发postinstall钩子,也可以直接npm run postinstall

    有一个我没有执行成功的做法
     1.安装electron-rebuild.
     2.配置scripts脚本
       "rebuild": "electron-rebuild -f -w sqlite3" 

    手动执行没有成功,不过我根据报错,分析出下载地址,自己把文件下载下来,放在sqlite3模块binding文件夹相应的平台文件夹里,可以用的。
    https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/electron-v6.0-win32-x64.tar.gz
       electron-builder install-app-deps 我手动执行这个,成功了,就编译出来了。
    还有直接编译法
      npm install sqlite3 --build-from-source --runtime=electron --target=2.0.7 --dist-url=https://atom.io/download/electron
     --target 参数的值是你安装的 electron 的版本
      这个方案我没有执行成功,编译报错。
    最简单方案
  • 相关阅读:
    SAP 锁对象
    smartforms取消word为默认编辑器
    abap 配置 zconfig
    Ant步步为营(1)解压本地的zip包
    点击页面出现文字动画
    js简单实现累加
    github发布线上项目
    jsonp的实现
    js操作class
    js开发实用技巧
  • 原文地址:https://www.cnblogs.com/nomarker/p/11453774.html
Copyright © 2011-2022 走看看