本人最近在开发一个基于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
请教各位大神有没好的解决办法