安装sqlite3模块后无法重建我的电子应用程序

时间:2018-08-04 15:50:32

标签: node.js npm sqlite electron

当我尝试使用命令“ electron-rebuild -f -w sqlite3”重建代码时。我在Windows上收到此错误。

An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.3 | win32 | x64
gyp http GET https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http 200 https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http GET https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\company             ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-    gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\App\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\company ismi\\.electron-gyp\\.node-    gyp\\iojs-2.0.5\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\company ismi\\.electron-    gyp\\.node-gyp\\iojs-2.0.5',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\company ismi\\.electron-    gyp\\.node-gyp\\iojs-2.0.5\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\App\\node_modules\\sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\App\\node_modules\\sqlite3\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\App\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error:     `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit     code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\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:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.5" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=C:\\App\\node_modules\\sqlite3\\lib\\binding\\electron-v2.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
gyp ERR! cwd C:\App\node_modules\sqlite3
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok

Failed with exit code: 1

Error: gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.3 | win32 | x64
gyp http GET https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http 200 https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http GET https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\company 
ismi\\AppData\\Roaming\\npm\\node_modules\\electron- 
rebuild\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\App\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\company     ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-    gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\company ismi\\.electron-gyp\\.node-    gyp\\iojs-2.0.5\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\company ismi\\.electron-    gyp\\.node-gyp\\iojs-2.0.5',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\company     ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-    gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\company ismi\\.electron-gyp\\.node-gyp\\iojs-2.0.5\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\App\\node_modules\\sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\App\\node_modules\\sqlite3\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel     build, please add the "/m" switch.
C:\App\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3):     error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

gyp错误!建立错误    糟糕!堆栈错误:    C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe失败,退出代码:1     糟糕!堆栈在ChildProcess.onExit(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ node-gyp \ lib \ build.js:262:23) 糟糕!堆叠在generateTwo(events.js:126:13) 糟糕!堆栈在ChildProcess.emit(events.js:214:7) 糟糕!堆栈位于Process.ChildProcess._handle.onexit(内部/child_process.js:198:12) 糟糕!系统Windows_NT 10.0.17134 糟糕!命令“ C:\ Program Files \ nodejs \ node.exe”“ C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ node-gyp \ bin \ node-gyp.js”“重建“” --target = 2.0.5“” --arch = x64“” --dist-url = https://atom.io/download/electron“”-从源构建“” --module_name = node_sqlite3“”- module_path = C:\ App \ node_modules \ sqlite3 \ lib \ binding \ electron-v2.0-win32-x64“” --host = https://mapbox-node-binary.s3.amazonaws.com“”“ --remote_path =。/ {name} /v4.0.2 / {toolset} /“” --package_name = electron-v2.0-win32-x64.tar.gz“ 糟糕! CWD C:\ App \ node_modules \ sqlite3 糟糕!节点-v v8.11.3 糟糕!节点gyp -v v3.7.0 糟糕!不好

失败,退出代码:1     在SafeSubscriber._error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ spawn-rx \ lib \ src \ index.js:277:84)     在SafeSubscriber .__ tryOrUnsub(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:242:16)     发生在SafeSubscriber.error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:201:26)     在Subscriber._error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:132:26)     在Subscriber.error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:106:18)     在MapSubscriber.Subscriber._error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:132:26)     在MapSubscriber.Subscriber.error(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:106:18)     在SafeSubscriber._next(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ spawn-rx \ lib \ src \ index.js:251:65)     在SafeSubscriber .__ tryOrUnsub(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:242:16)     在SafeSubscriber.next(C:\ Users \ company ismi \ AppData \ Roaming \ npm \ node_modules \ electron-rebuild \ node_modules \ rxjs \ Subscriber.js:189:22)

我该如何解决。但是相同的应用程序在Mac系统下可以正常工作。
请指导我解决此错误。

2 个答案:

答案 0 :(得分:0)

您是否要同时为x86和x64 arch构建?并请正确格式化问题。看起来node-gyp正在使用本地缓存中的某些数据。您是否尝试清洁AppData文件夹?

答案 1 :(得分:0)

我会做什么:

  1. 转到sqlite3所在的文件夹,例如./node_modules/sqlite3。

  2. 确保已为MS Windows安装了Visual Studio编译器和python。

  3. 编辑./node_modules/sqlite3/package.json并在脚本部分添加新条目:

    “ build_vcust”:“节点预石膏重建–target = X.X.X --arch = x64 --dist-url = https://atom.io/download/electron --msvs_version = 2015“

    注意:用您的电子版本替换X.X.X。

  4. 从sqlite3文件夹中执行“ npm run build_vcust”。

有关(参考)的更多信息:https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md