gpt4 book ai didi

node.js - 在 Windows 10 上为 Electron 应用程序构建 sqlite3

转载 作者:搜寻专家 更新时间:2023-10-31 23:33:59 24 4
gpt4 key购买 nike

我正在尝试在 Windows 10 上使用 sqlite3 数据存储制作一个简单的 Electron 应用程序。

似乎由于一些 node-gyp 问题我无法构建 sqlite3。错误的堆栈跟踪。

  • rebuilding native production dependencies platform=win32 arch=x64
Error: C:\Program Files\nodejs\node.exe exited with code 1
Output:

> sqlite3@4.0.2 install C:\Users\Ilya\puppy\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

�믮������ ��᫥����⥫쭠� ᡮઠ �஥�⮢ � �⮬ �襭��. �⮡� ������� ��ࠫ������ ᡮ��, ������� ��ࠬ��� "/m".
MSBUILD : error MSB4025: �� 㤠���� ����㧨�� 䠩� �஥��. ��������� ��୥��� �����.
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64 --napi_version=3 --node_abi_napi=napi' (1)

Error output:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v3.0-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.2 and electron@3.0.0 (electron-v3.0 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\Ilya\\puppy\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\Ilya\\puppy\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd C:\Users\Ilya\puppy\node_modules\sqlite3
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\Ilya\puppy\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Ilya\\puppy\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Ilya\puppy\node_modules\sqlite3
node-pre-gyp ERR! node -v v8.11.3
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ilya\AppData\Roaming\npm-cache\_logs\2018-10-07T18_17_21_376Z-debug.log

at ChildProcess.childProcess.once.code (C:\Users\Ilya\puppy\node_modules\builder-util\src\util.ts:254:14)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
at rebuild (C:\Users\Ilya\puppy\node_modules\app-builder-lib\out\util\yarn.js:239:18)
at C:\Users\Ilya\puppy\node_modules\app-builder-lib\src\util\yarn.ts:20:11
From previous event:
at installOrRebuild (C:\Users\Ilya\puppy\node_modules\app-builder-lib\out\util\yarn.js:68:17)
at C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:56:9
at Generator.next (<anonymous>)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at installAppDeps (C:\Users\Ilya\puppy\node_modules\electron-builder\out\cli\install-app-deps.js:174:17)
at main (C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:65:10)
at Object.<anonymous> (C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:70:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppy@1.0.0 postinstall: `install-app-deps`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppy@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ilya\AppData\Roaming\npm-cache\_logs\2018-10-07T18_17_21_461Z-debug.log

我试过但没有帮助:

  • 安装 python2.7 然后 npm config set --python=C:\path\to\python
  • npm install --global --production windows-build-tools
  • 以管理员身份运行 npm install
  • 从 VS2017 控制台运行 npm 安装
  • 更新 npm 和 node-gyp 版本
  • 删除我的 Node 模块并重新安装

都一样,我一直收到这个错误。您对如何使 sqlite3 构建成为可能有任何想法吗?

Node 版本:8.11.3NPM版本:5.6.0

最佳答案

我认为原因是 sqlite3@4.0.2 似乎(还)不兼容最近发布的 electron@3.0.3。当您查看日志时,您会发现下载相应的包失败:
node-pre-gyp WARN 尝试下载(403):https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v3.0-win32-x64.tar。 z

相反,当您尝试打开 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v2.0-win32-x64.tar.gz 在您的浏览器中,它可以工作。

我目前发现了同样的问题。使用旧版本的 Electron 对我有用。我的 package.json 看起来像这样:
"sqlite3": "^4.0.2",
...
“Electron ”:“2.0.7”,
“Electron build 者”:“20.28.1”,

希望对您有所帮助!


更新:几天前sqlite3@4.0.3已经发表。这个版本解决了这个问题,现在可以与 electron@3.0.6 一起使用。我的依赖项现在看起来像这样:
"sqlite3": "^4.0.3",
...
“Electron ”:“3.0.6”,
“Electron build 者”:“20.28.4”,

关于node.js - 在 Windows 10 上为 Electron 应用程序构建 sqlite3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52692839/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com