blu*_*e13 12 google-chrome-devtools reactjs electron
I'm developing an electron app with React for the front-end. I get the following error in my console when I run my app and hit refresh. My app works as expected, but it's kind of annoying to see this error pop up in my console and not know what it means. Any ideas?
This is the error message I get in my console:
[1] [36084:0511/083524.886880:ERROR:CONSOLE(972)] "TypeError: Cannot read property 'pseudoType' of undefined TypeError: Cannot read property 'pseudoType' of undefined
[1] at SDK.DOMNode._removeChild (chrome-devtools://devtools/bundled/shell.js:4301:28)
[1] at SDK.DOMModel._childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4420:121)
[1] at SDK.DOMDispatcher.childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4464:54)
[1] at Protocol.InspectorBackend._DispatcherPrototype.dispatch (chrome-devtools://devtools/bundled/shell.js:3399:26)
[1] at Protocol.SessionRouter._onMessage (chrome-devtools://devtools/bundled/shell.js:3355:41)
[1] at SDK.MainConnection._dispatchMessage (chrome-devtools://devtools/bundled/shell.js:3486:17)
[1] at Common.Object.dispatchEventToListeners (chrome-devtools://devtools/bundled/shell.js:494:23)
[1] at innerDispatch (chrome-devtools://devtools/bundled/shell.js:972:98)
[1] at Host.InspectorFrontendAPIImpl._dispatch (chrome-devtools://devtools/bundled/shell.js:972:1)
[1] at DevToolsAPIImpl._dispatchOnInspectorFrontendAPI (chrome-devtools://devtools/bundled/devtools_compatibility.js:57:36)", source: chrome-devtools://devtools/bundled/shell.js (972)
Run Code Online (Sandbox Code Playgroud)
I've isolated the error to this snippet of code below. If I comment it out, I don't get the error. I couldn't find the cause of the error by reading the BrowserWindow docs.
BrowserWindow.addDevToolsExtension(
path.join(
os.homedir(),
"/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.6.0_0"
)
);
BrowserWindow.addDevToolsExtension(
path.join(
os.homedir(),
"/Library/Application Support/Google/Chrome/Default/Extensions/lmhkpmbekcpmknklioeibfkpmmfibljd/2.17.0_0"
)
);
mainWindow.webContents.openDevTools();
Run Code Online (Sandbox Code Playgroud)
小智 1
我认为这里的问题可能有两种不同的类型:路径不正确,已经存在一个作为参数传递的路径,或者在模块应用程序处于就绪状态之前调用此函数。
为了解决第一个问题,我将测试返回代码不同部分的路径os.homedir(),以查看将其与函数中指示的路径连接时最终会是什么join;"/Library/Application/Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.6.0_0"。
为了解决第二个问题,我将重构代码以在适当的生命周期点调用该函数,以确保应用程序模块处于就绪状态。
| 归档时间: |
|
| 查看次数: |
1124 次 |
| 最近记录: |