zoukankan      html  css  js  c++  java
  • 准备在electron上用vue,结果卡在了sqlite3

    vue.js看书有一段时间了,也准备动手做一个electron的程序。目录似乎有两种方式搭建方式

    一种是使用vue.cli构建工具,就是所谓的脚手架,分别安装vue和electron

    https://www.cnblogs.com/jiangxifanzhouyudu/p/9517651.html

    一种是直接安装electron-vue组件,一步完成vue和electron的安装

    https://blog.csdn.net/github_36978270/article/details/78460696

      安装构造工具 

    #npm install -g vue-cli

    使用构造工具创建项目

    #vue init simulatedgreg/electron-vue my-project

    基本上一路回车就是了。不知道的可以选择NO

    在安装sqlite3后,运行程序时,死活说找不到路径,

    "Error: Cannot find module 'D:Fasaccountselec-fsacc ode_modulessqlite3libindingelectron-v2.0-win32-x64 ode_sqlite3.node'"

    检查安装后的路径,却只有

    D:Fasaccountselec-fsacc ode_modulessqlite3libinding ode-v64-win32-x64 ode_sqlite3.node

    就是后面的目录名不同。运行的程序找的是electron-v2.0-win32-x64,安装却在node-v64-win32-x64。百度之后,似乎是需要为electron重新编译,但好几个方法在两台安装了vs2017的win10上都编译不了。,直到看到这个

    https://blog.csdn.net/CaanDoll/article/details/81429171

    参考上面的地址的说明,我先

    npm i sqlite3 --save

    我没有按文章去修改package.json,于是在执行上面的命令后,我再执行

    install-app-deps

    于是一台电脑成功编译,另一台却找不到命令。之后找到这个一个帖子

    https://stackoverflow.com/questions/32504307/how-to-use-sqlite3-module-with-electron

    上面网址速度比较慢,我帖上主要回复内容

    =================================================================================

    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.

    ===================================================================================

    原来需要安装electron-builder,至此总算搞定sqlite3的安装。 

  • 相关阅读:
    js兼容性——获取当前浏览器窗口的宽高
    pip 换源
    5 二分查找 算法
    顺序查找 冒泡 快排 等
    4 顺序表和链表
    python垃圾回收机制
    3 栈 队列 双头队列
    2 数据结构的性能分析 timeit
    1 时间复杂度
    线程池 爬取一本小说
  • 原文地址:https://www.cnblogs.com/kevin-Y/p/10346517.html
Copyright © 2011-2022 走看看