electron 本地数据持久化 sqlite3
electron,创建的程序时可以运行的,当添加sqlite3时,编译就过不去了,因为sqlite3是C++写的,所以在使用的时候我们不能直接用,需要编译下才可以使用
1.首先下载了electron-rebuild
npm install --save electron-rebuild
2.然后,下载了sqlite3
npm install --save sqlite3
or
cnpm install sqlite3 --build-from-source --runtime=electron --target=4.0.3 --dist-url=https://atom.io/download/electron --save
or
cnpm install sqlite3@latest --build-from-source --runtime=electron --target=1.7.9 --dist-url=https://atom.io/download/electron --save
3.修改了package.json,在scripts命令中添加此条
"scripts": { "rebuild": "electron-rebuild -f -w sqlite3" },
4.运行编译
npm run rebuild

浙公网安备 33010602011771号