qq_40198931 2020-09-04 08:49 采纳率: 0%
浏览 973

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

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

  • 写回答

7条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?