Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"TypeError: Cannot read property 'pseudoType' of undefined" with chrome-devtools

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)

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();
like image 495
bluprince13 Avatar asked May 11 '19 07:05

bluprince13


1 Answers

I think that the problems here could be of two different types: the path is incorrect, there is already a path that exists as the one you passed as a parameter or you are calling this function before that the module app is on its ready state.

To solve the first problem i would test the path that os.homedir() gives you back in a different part of the code to see what ends up to be at the time that you join it with the path indicated in the function join; "/Library/Application/Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.6.0_0".

To solve the second problem i would refactor the code to call the function in the appropriate lifecycle point to be sure that the app module is on the ready state.

like image 136
Devolux Avatar answered Nov 10 '22 09:11

Devolux