Error: Cannot find module \node_modules\sqlite3\lib\binding\electron-v8.0-win32-x64\node_sqlite3.node'

怎甘沉沦 提交于 2021-02-07 09:38:03

问题


I have trouble with installing sqlite3 in electron 8.1 I got following errors

Error: Cannot find module 'D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\binding\electron-v8.1-win32-x64\node_sqlite3.node'
Require stack:
- D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\sqlite3.js
- D:\TASK(2020.1.1~)\AMS\main.js
- D:\TASK(2020.1.1~)\AMS\node_modules\electron\dist\resources\default_app.asar\main.js
-
    at Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
    at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7595:16)
    at Module._load (internal/modules/cjs/loader.js:691:27)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:853:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\sqlite3.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:968:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)

I installed npm install sqlite3 --build-from-source --runtime=electron --target=8.0.2 --dist-url=https://atom.io/download/electron But no luck. Please help me.


回答1:


Finally, I figured out and solved. needed to followings

"scripts": {
    "start": "electron .",
    "postinstall": "electron-builder install-app-deps",
    "package": "electron-packager . --production"
  },

after that, npm run postinstall it worked for me.



来源:https://stackoverflow.com/questions/60646719/error-cannot-find-module-node-modules-sqlite3-lib-binding-electron-v8-0-win32

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!