简体   繁体   English

更新电子反应应用程序后 sqlite3 出错

[英]Error with sqlite3 after updating electron-react app

After updating my electron-react app, when I try to start it with npm run dev I get the console error message saying that I need to manually install sqlite3.更新我的电子反应应用程序后,当我尝试使用 npm run dev 启动它时,我收到控制台错误消息,提示我需要手动安装 sqlite3。

The sqlite3 is installed @4.0.6, React@16.8.6, Electron@3.1.6 sqlite3 安装了@4.0.6、React@16.8.6、Electron@3.1.6

After some digging, I tried a couple of solutions from stackoverflow and git, but none worked.经过一番挖掘,我尝试了一些来自 stackoverflow 和 git 的解决方案,但都没有奏效。 I tried for example installing electron-builder , electron-rebuilder, etc.例如,我尝试安装electron-builder 、 electron-rebuilder 等。

After using the electron-rebuild directly, I managed to get the app to run with npm run dev , but when I try to package it or use electron-builder install-app-deps I get the following error message直接使用electron-rebuild后,我设法让应用程序运行npm run dev ,但是当我尝试打包它或使用electron-builder install-app-deps时,我收到以下错误消息

  • electron-builder version=20.39.0
  • loaded configuration file=package.json ("build" field)
  • rebuilding native production dependencies platform=win32 arch=x64
Error: C:\Program Files\nodejs\node.exe exited with code 1
Output:

> sqlite3@4.0.6 install D:\Projects\Node\Rex-Importer\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  unpack_sqlite_dep
  'C:\Users\Nuno' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [D:\Projects\Node\Rex-Importer\node_modules\sqlite3\build\deps\action_before_build.vcxproj]
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=D:\Projects\Node\Rex-Importer\node_modules\sqlite3\lib\binding\electron-v3.1-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\Projects\Node\Rex-Importer\node_modules\sqlite3\lib\binding\electron-v3.1-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v3.1' (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.6/electron-v3.1-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.6 and electron@3.1.6 (electron-v3.1 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` 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 ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
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=D:\\Projects\\Node\\Rex-Importer\\node_modules\\sqlite3\\lib\\binding\\electron-v3.1-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\Projects\\Node\\Rex-Importer\\node_modules\\sqlite3\\lib\\binding\\electron-v3.1-win32-x64" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v3.1"
gyp ERR! cwd D:\Projects\Node\Rex-Importer\node_modules\sqlite3
gyp ERR! node -v v10.15.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=D:\Projects\Node\Rex-Importer\node_modules\sqlite3\lib\binding\electron-v3.1-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\Projects\Node\Rex-Importer\node_modules\sqlite3\lib\binding\electron-v3.1-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v3.1' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Projects\Node\Rex-Importer\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Projects\\Node\\Rex-Importer\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\Projects\Node\Rex-Importer\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.6 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\Nuno Almeida\AppData\Roaming\npm-cache\_logs\2019-04-03T14_49_32_913Z-debug.log

    at ChildProcess.childProcess.once.code (D:\Projects\Node\Rex-Importer\node_modules\builder-util\src\util.ts:244:14)
    at Object.onceWrapper (events.js:277:13)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
From previous event:
    at _rebuild (D:\Projects\Node\Rex-Importer\node_modules\app-builder-lib\src\util\yarn.ts:179:5)
    at rebuild (D:\Projects\Node\Rex-Importer\node_modules\app-builder-lib\out\util\yarn.js:163:19)
    at D:\Projects\Node\Rex-Importer\node_modules\app-builder-lib\src\util\yarn.ts:20:11
From previous event:
    at _installOrRebuild (D:\Projects\Node\Rex-Importer\node_modules\app-builder-lib\out\util\yarn.js:71:28)
    at installOrRebuild (D:\Projects\Node\Rex-Importer\node_modules\app-builder-lib\out\util\yarn.js:55:28)
    at D:\Projects\Node\Rex-Importer\node_modules\electron-builder\src\cli\install-app-deps.ts:56:9
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-react-boilerplate@0.17.1 postinstall: `yarn flow-typed && electron-builder install-app-deps package.json && yarn build-dll && opencollective-postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-react-boilerplate@0.17.1 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\Nuno Almeida\AppData\Roaming\npm-cache\_logs\2019-04-03T14_49_32_973Z-debug.log

Has anyone came up to this?有没有人想到这个? I tried already a lot of things but I couldn't manage to get it working.我已经尝试了很多东西,但我无法让它发挥作用。

Thank you in advance先感谢您

You should do:你应该做:

npm i -g windows-build-tools

Because the error is related to Python (2.7), windows-build-tools has it shipped within itself.由于该错误与 Python (2.7) 有关,因此 windows-build-tools 已将其包含在自身中。 So to resolve it the next step is finding the Python-2.7 path:因此,要解决它,下一步是找到 Python-2.7 路径:

Should be stored in this path: C:\Users\${your_windows_username}\.windows-build-tools\python27\python.exe应该存储在这个路径中: C:\Users\${your_windows_username}\.windows-build-tools\python27\python.exe

Then assuming we have got the path we do:然后假设我们已经得到了我们要做的路径:

npm config set python C:\Users\${your_windows_username}\.windows-build-tools\python27\python.exe

That's it, the issue in my case was about sqlite not being properly installed, hope that helps you out!就是这样,我的问题是关于sqlite没有正确安装,希望对你有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM