1. 通过electron-devtools-installer下载插件需要科学上网

2. chrome官宣2023废弃了manifest v2, 升级到了manifest v3, 但electron还不支持manifest v3, 所以安装manifest v3 版本的react-devtools就失败了, 那么解决方式就是只要安装v2版本的react-devtools就可以了。

首先是electron启动时报错, 提示插件安装失败

(node:25612) ExtensionLoadWarning: Warnings loading extension at C:\Users\Ally\AppData\Roaming\Electron\extensions\fmkadmapgofadopljbjfkapdkoienihi:
  Permission 'scripting' is unknown or URL pattern is malformed.
(Use `electron --trace-warnings ...` to show where the warning was created)
00:04:03.843 > Skip checkForUpdatesAndNotify because application is not packed
00:04:03.888 > checkForUpdatesAndNotify called, downloadPromise is null
[25612:0213/000404.287:ERROR:extensions_browser_client.cc(61)] Extension Error:
  OTR:     false
  Level:   2
  Source:  chrome-extension://lifekjadeemmahelfgcjicjflaipongp/build/background.js
  Message: Uncaught TypeError: Cannot read properties of undefined (reading 'registerContentScripts')
  ID:      lifekjadeemmahelfgcjicjflaipongp
  Type:    RuntimeError
  Context: chrome-extension://lifekjadeemmahelfgcjicjflaipongp/build/background.js
  Stack Trace:
      Line:     107
      Column:   1
      URL:      chrome-extension://lifekjadeemmahelfgcjicjflaipongp/build/background.js
      Function: (anonymous function)
[25612:0213/000404.292:ERROR:extensions_browser_client.cc(61)] Extension Error:
  OTR:     false
  Level:   1
  Source:  manifest.json
  Message: Service worker registration failed
  ID:      lifekjadeemmahelfgcjicjflaipongp
  Type:    ManifestError
IPC test: ping
[25612:0213/000405.500:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160)
[25612:0213/000405.501:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)

解决方式1: 手动下载插件

1.1 下载文件polypane.app/fmkadmapgof…

1.2 解压到你的electron目录下, 我的是C:\Users\userName\AppData\Roaming\Electron\extensions\fmkadmapgofadopljbjfkapdkoienihi

解决方式2

用bash脚本下载并解压替换

2.1 新建bash.txt文件

extension="/path/to/your/data/extensions/fmkadmapgofadopljbjfkapdkoienihi"
manifest="$extension/manifest.json"
if ! [ -f $manifest ]; then
  echo manifest doesn't exist, cannot patch
  exit 0
md5=`md5sum $manifest | awk '{split($0,a," "); print a[1]}'`
if [ "$md5" = "e821851e1ba9ff96244025afa8178b06" ]; then
  echo manifest is already correct
  exit 0
echo fixing extension
curl https://polypane.app/fmkadmapgofadopljbjfkapdkoienihi.zip --output extensions-fix.zip
rm -r $extension
mkdir $extension
unzip extensions-fix.zip -d $extension
rm extensions-fix.zip

2.2 修改为你的extension路径, 这里我的extension是C:/Users/userName/AppData/Roaming/Electron/extensions/fmkadmapgofadopljbjfkapdkoienihi

2.3 鼠标右键Git Base Here

sh  bash.txt

github.com/electron-re…

github.com/electron-re…

github.com/facebook/re…

github.com/electron/el…