我正在尝试使用Windows 10上的sqlite3数据存储制作一个简单的电子应用程序。
似乎由于某些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
我尝试过的方法却无济于事:
npm config set --python=C:\path\to\python
都一样,我一直收到此错误。您是否有任何想法使sqlite3构建成为可能?
节点版本:8.11.3 NPM版本:5.6.0
答案 0 :(得分:6)
我认为原因是sqlite3@4.0.2似乎与最近发布的electronic@3.0.3不兼容。查看日志时,您会发现下载相应的软件包失败:
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
相反,当您尝试在浏览器中打开https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v2.0-win32-x64.tar.gz
时,它将起作用。
我目前正在发现相同的问题。使用旧版电子对我有效。我的package.json
看起来像这样:
"sqlite3": "^4.0.2",
...
"electron": "2.0.7",
"electron-builder": "20.28.1",
希望有帮助!
更新:几天前sqlite3@4.0.3已经发布。这个版本解决了这个问题,现在可以与electron@3.0.6一起使用。我的依赖项现在看起来像这样:
"sqlite3": "^4.0.3",
...
"electron": "3.0.6",
"electron-builder": "20.28.4",