electron-vue中sqlite3编译完成后,引入依赖报错

本人最近在开发一个基于electron桌面端的项目,需要使用sqlite3做数据的本地化存储,技术路线是这样的:先用vue编写,然后使用electron-build打包桌面端,至此前面的内容都已走通。但是,在使用sqlite3进行本地化存储过程中,按照已有的教程引入sqlite3并重新编译,没有出现问题,但是在引入sqlite3依赖没有进行其他操作时却出现问题

import sqldb from 'sqlite3'

报错内容如下

warning  in ./node_modules/sqlite3/lib/sqlite3-binding.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/pre-binding.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/versioning.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js

Module not found: Error: Can't resolve 'npm' in 'E:\WebDevelopment\CaibianSystem\d2-admin-start-kit-master\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util'     

 warning  in ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html

Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders      
> <!DOCTYPE html>
| <html>
| <head>

 @ ./node_modules/sqlite3/node_modules/node-pre-gyp/lib sync ^\.\/.*$
 @ ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/node-pre-gyp.js
 @ ./node_modules/sqlite3/lib/sqlite3-binding.js
 @ ./node_modules/sqlite3/lib/sqlite3.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.42.37:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

 warning  in ./node_modules/node-gyp/lib/Find-VS2017.cs

Module parse failed: Unexpected token (7:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders      
| // Usage:
| // powershell -ExecutionPolicy Unrestricted -Version "2.0" -Command "&{Add-Type -Path Find-VS2017.cs; [VisualStudioConfiguration.Main]::Query()}"
> using System;
| using System.Text;
| using System.Runtime.InteropServices;

 @ ./node_modules/node-gyp/lib sync ^\.\/.*$
 @ ./node_modules/node-gyp/lib/node-gyp.js
 @ ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js
 @ ./node_modules/sqlite3/node_modules/node-pre-gyp/lib sync ^\.\/.*$
 @ ./node_modules/sqlite3/node_modules/node-pre-gyp/lib/node-pre-gyp.js
 @ ./node_modules/sqlite3/lib/sqlite3-binding.js
 @ ./node_modules/sqlite3/lib/sqlite3.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.42.37:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

请教各位大神有没好的解决办法

https://blog.csdn.net/weixin_30346033/article/details/97674761

你好,我也在进行electron-vue-sqlite这样一个项目,sqlite编译没有问题,在引入sqlite的db.js文件中能够读取到相应的table信息,但是我无法将table内容导入vue中的表格中,还望您能指点我一下,谢谢

您好,目前我也出现了这个问题,编译sqlite没有出错,使用sqlite出现这个错误,还请看到回答一下,谢谢

请问解决了没有呀

问题解决了吗,我也是同样的问题,求方法

请问解决了没,大概是怎么解决的。网上方法无效

这个您解决了吗?如何解决的呀

请问怎么解决的?