V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TomeWong
V2EX  ›  程序员

electron 在 web worker 子线程中无法引入 sqlite3

  •  
  •   TomeWong · 2020-05-15 11:22:55 +08:00 · 1425 次点击
    这是一个创建于 1656 天前的主题,其中的信息可能已经有所发展或是发生改变。

    引入会报如下的错误

          ERROR in ./node_modules/node-pre-gyp/lib/info.js
          Module not found: Error: Can't resolve 'aws-sdk' in 'D:\pc-win\node_modules\node-pre-gyp\lib'
           @ ./node_modules/node-pre-gyp/lib/info.js 14:14-32
           @ ./node_modules/node-pre-gyp/lib sync ^\.\/.*$
           @ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
           @ ./node_modules/sqlite3/lib/sqlite3-binding.js
           @ ./node_modules/sqlite3/lib/sqlite3.js
           @ ./src/renderer/utils/sqlite.js
           @ ./node_modules/babel-loader/lib!./src/renderer/utils/Worker.js
    
          ERROR in ./node_modules/node-pre-gyp/lib/publish.js
          Module not found: Error: Can't resolve 'aws-sdk' in 'D:\pc-win\SKYD-win\node_modules\node-pre-gyp\lib'
           @ ./node_modules/node-pre-gyp/lib/publish.js 18:14-32
           @ ./node_modules/node-pre-gyp/lib sync ^\.\/.*$
           @ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
           @ ./node_modules/sqlite3/lib/sqlite3-binding.js
           @ ./node_modules/sqlite3/lib/sqlite3.js
           @ ./src/renderer/utils/sqlite.js
           @ ./node_modules/babel-loader/lib!./src/renderer/utils/Worker.js
    
          ERROR in ./node_modules/node-pre-gyp/lib/unpublish.js
          Module not found: Error: Can't resolve 'aws-sdk' in 'D:\pc-win\SKYD-win\node_modules\node-pre-gyp\lib'
           @ ./node_modules/node-pre-gyp/lib/unpublish.js 16:14-32
           @ ./node_modules/node-pre-gyp/lib sync ^\.\/.*$
           @ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
           @ ./node_modules/sqlite3/lib/sqlite3-binding.js
           @ ./node_modules/sqlite3/lib/sqlite3.js
           @ ./src/renderer/utils/sqlite.js
           @ ./node_modules/babel-loader/lib!./src/renderer/utils/Worker.js
    

    是不是不支持在 web worker 子线程引入

    2 条回复    2020-05-18 10:46:06 +08:00
    96412hj
        1
    96412hj  
       2020-05-18 10:43:06 +08:00
    引这个干什么
    TomeWong
        2
    TomeWong  
    OP
       2020-05-18 10:46:06 +08:00
    @96412hj 不经过 web worker postMessage 传递数据,而是直接在 web worker 中处理
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1113 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:03 · PVG 03:03 · LAX 11:03 · JFK 14:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.