无法在基于电子vue样板的项目中测试更好的sqlite3

时间:2018-01-19 09:02:08

标签: node.js vue.js electron yarnpkg better-sqlite3

我使用electron-vue为我的项目生成基础。我可以让我的应用程序启动,但是当我尝试运行yarn test时,我收到以下错误:

Child html-webpack-plugin for "index.html":
                                   Asset      Size  Chunks             Chunk Names
                              index.html    568 kB       1             
    db649fa959425ff07a09.hot-update.json  44 bytes          [emitted]  
       [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 1.46 kB {1} [built]
       [1] ./node_modules/lodash/lodash.js 540 kB {1} [built]
       [2] (webpack)/buildin/module.js 517 bytes {1} [built]
19 01 2018 02:30:17.603:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
19 01 2018 02:30:17.605:INFO [launcher]: Launching browser visibleElectron with unlimited concurrency
19 01 2018 02:30:17.618:INFO [launcher]: Starting browser Electron
19 01 2018 02:30:19.579:INFO [Electron 1.7.9 (Node 7.9.0)]: Connected on socket XnzwV7bi3QYEDoyCAAAA with id 16128747
Electron 1.7.9 (Node 7.9.0) ERROR
  Uncaught Error: Could not locate the bindings file. Tried:
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/out/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/default/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/compiled/7.9.0/linux/x64/better_sqlite3.node
  at webpack:///node_modules/bindings/bindings.js:96:0 <- index.js:30116

Electron 1.7.9 (Node 7.9.0): Executed 0 of 0 ERROR (1.957 secs / 0 secs)

绑定确实存在:

find $HOME/workspace/tagister/node_modules/better-sqlite3/ -name "*node"
/home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/test_extension.node
/home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/better_sqlite3.node
/home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/obj.target/test_extension.node
/home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/obj.target/better_sqlite3.node

要让better-sqlite3在开发模式下工作,我必须将"postinstall": "electron-builder install-app-deps"添加到package.json。我不明白为什么当依赖模块明显存在时测试失败了。

我认为这可能是一个错误并添加了issue to electron's github但是没有任何评论。

可以使用以下内容在本地复制:

git clone https://gitlab.com/djsumdog/tagster.git
git checkout ca712c4c
yarn
yarn test

0 个答案:

没有答案