【发布时间】:2021-03-11 02:06:54
【问题描述】:
我知道网上有很多关于如何做到这一点的文章。我已经尝试了很多,但始终无法将其投入使用。 我目前正在尝试使用它:https://github.com/CosmicEon/Electron-React-Material-SQLite。 我的系统: 视窗 10 节点 15.1.0 npm 7.0.11
每次我尝试重建 sqlite 时都会出错。在尝试运行时
>npm run rebuild
我明白了:
> material-dashboard-react@1.0.0 rebuild
> electron-rebuild -f -w sqlite3
× Rebuild Failed
An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@15.1.0 | win32 | x64
gyp http GET https://atom.io/download/electron/v1.8.2/iojs-v1.8.2.tar.gz
gyp http 200 https://atom.io/download/electron/v1.8.2/iojs-v1.8.2.tar.gz
gyp http GET https://atom.io/download/electron/v1.8.2/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v1.8.2/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v1.8.2/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v1.8.2/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v1.8.2/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v1.8.2/win-x86/iojs.lib
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\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=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2',
gyp info spawn args '-Dnode_gyp_dir=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2\\<(target_arch)\\iojs.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents',
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:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2019, in GenerateOutput
sln_projects, project_objects, flat=msvs_version.FlatSolution())
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1778, in _GatherSolutionFolders
return _DictsToFolders('', root, flat)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1731, in _DictsToFolders
for folder, contents in bucket.iteritems():
AttributeError: 'MSVSProject' object has no attribute 'iteritems'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at ChildProcess.emit (node:events:327:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\app\\nodejs\\node.exe" "C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.8.2" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=fse" "--module_path=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\lib\\binding\\Release\\electron-v1.8-win32-x64" "--remote_path=./v1.1.2/" "--package_name=fse-v1.1.2-electron-v1.8-win32-x64.tar.gz" "--host=https://fsevents-binaries.s3-us-west-2.amazonaws.com"
gyp ERR! cwd C:\workspace\eTimer\e-timer-2\node_modules\fsevents
gyp ERR! node -v v15.1.0
gyp ERR! node-gyp -v v3.6.2
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.6.2
gyp info using node@15.1.0 | win32 | x64
gyp http GET https://atom.io/download/electron/v1.8.2/iojs-v1.8.2.tar.gz
gyp http 200 https://atom.io/download/electron/v1.8.2/iojs-v1.8.2.tar.gz
gyp http GET https://atom.io/download/electron/v1.8.2/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v1.8.2/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v1.8.2/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v1.8.2/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v1.8.2/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v1.8.2/win-x86/iojs.lib
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\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=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2',
gyp info spawn args '-Dnode_gyp_dir=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\USER\\.electron-gyp\\.node-gyp\\iojs-1.8.2\\<(target_arch)\\iojs.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents',
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:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2019, in GenerateOutput
sln_projects, project_objects, flat=msvs_version.FlatSolution())
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1778, in _GatherSolutionFolders
return _DictsToFolders('', root, flat)
File "C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1731, in _DictsToFolders
for folder, contents in bucket.iteritems():
AttributeError: 'MSVSProject' object has no attribute 'iteritems'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\workspace\eTimer\e-timer-2\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at ChildProcess.emit (node:events:327:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\app\\nodejs\\node.exe" "C:\\workspace\\eTimer\\e-timer-2\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.8.2" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=fse" "--module_path=C:\\workspace\\eTimer\\e-timer-2\\node_modules\\fsevents\\lib\\binding\\Release\\electron-v1.8-win32-x64" "--remote_path=./v1.1.2/" "--package_name=fse-v1.1.2-electron-v1.8-win32-x64.tar.gz" "--host=https://fsevents-binaries.s3-us-west-2.amazonaws.com"
gyp ERR! cwd C:\workspace\eTimer\e-timer-2\node_modules\fsevents
gyp ERR! node -v v15.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Failed with exit code: 1
at SafeSubscriber._error (C:\workspace\eTimer\e-timer-2\node_modules\spawn-rx\lib\src\index.js:277:84)
at SafeSubscriber.__tryOrUnsub (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:239:16)
at SafeSubscriber.error (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:198:26)
at Subscriber._error (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:129:26)
at Subscriber.error (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:103:18)
at MapSubscriber.Subscriber._error (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:129:26)
at MapSubscriber.Subscriber.error (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:103:18)
at SafeSubscriber._next (C:\workspace\eTimer\e-timer-2\node_modules\spawn-rx\lib\src\index.js:251:65)
at SafeSubscriber.__tryOrSetError (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:248:16)
at SafeSubscriber.next (C:\workspace\eTimer\e-timer-2\node_modules\rxjs\Subscriber.js:188:27)
npm ERR! code 4294967295
npm ERR! path C:\workspace\eTimer\e-timer-2
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "electron-rebuild -f -w sqlite3"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache\_logs\2020-11-28T15_57_54_619Z-debug.logenter code here
我还安装了一些文章提到的 viual studio 构建工具..
我想知道这是否根本不适用于 node/npm 最新版本...有什么帮助吗?
========================更新======================= =============
尝试了@Seti 提到的样板,但仍然没有运气。当我尝试运行“纱线”时,我得到:
PS C:\workspace\etimer\e-timer-3\e-timer> yarn yarn install v1.22.5
[1/4] Resolving packages...
success Already up-to-date.
$ node -r @babel/register .erb/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js && opencollective-postinstall && yarn-deduplicate yarn.lock
Native dependencies could not be checked
• electron-builder version=22.9.1
• loaded configuration file=package.json ("build" field)
• installing production dependencies platform=win32 arch=x64 appDir=C:\workspace\etimer\e-timer-3\e-timer\src
yarn run v1.22.5
$ C:\workspace\etimer\e-timer-3\e-timer\node_modules\.bin\cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js
[webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation
at Function.getCompilationHooks (C:\workspace\etimer\e-timer-3\e-timer\node_modules\webpack\lib\NormalModule.js:171:10)
at C:\workspace\etimer\e-timer-3\e-timer\node_modules\webpack\lib\LoaderOptionsPlugin.js:43:17
at Hook.eval (eval at create (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:104:1)
at Hook.CALL_DELEGATE [as _call] (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\webpack\lib\Compiler.js:943:26)
at C:\workspace\eTimer\e-timer-3\e-timer\node_modules\webpack\lib\Compiler.js:984:29
at Hook.eval [as callAsync] (eval at create (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (C:\workspace\eTimer\e-timer-3\e-timer\node_modules\webpack\lib\Compiler.js:979:28)
at C:\workspace\eTimer\e-timer-3\e-timer\node_modules\webpack\lib\Compiler.js:470:12
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
可能是我的环境出了点问题……请帮忙
【问题讨论】:
-
嘿,我认为这可能与旧版本的 npm 有关,请检查此问题 => github.com/nodejs/node-gyp/issues/661,可能升级 npm 应该可以解决它
-
我使用的 npm 版本高于该问题中报告的任何版本。我错过了什么吗?
-
我知道你说你已经安装了构建工具,但为了确保
npm install --global --production windows-build-tools这是全局正确的,不要一起使用纱线和节点,他们往往会把事情搞砸,在这之前只是 @ 987654327@