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

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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog