75 lines
15 KiB
HTML
75 lines
15 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width">
|
|
<meta name="generator" content="Docusaurus">
|
|
<link rel="preconnect" href="https://www.google-analytics.com">
|
|
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-145065218-1","auto"),ga("send","pageview")</script>
|
|
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
|
|
|
<title data-react-helmet="true">Debugging | NodeGui</title>
|
|
|
|
<meta data-react-helmet="true" http-equiv="x-ua-compatible" content="ie=edge"><meta data-react-helmet="true" property="og:title" content="NodeGui"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="description" content="## Application Debugging"><meta data-react-helmet="true" property="og:description" content="## Application Debugging"><meta data-react-helmet="true" property="og:url" content="https://nodegui.org/docs/guides/debugging">
|
|
|
|
<link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico">
|
|
|
|
|
|
<link rel="stylesheet" href="/styles.5d0c291d.css">
|
|
|
|
|
|
<link rel="preload" href="/styles.edba8c47.js" as="script">
|
|
|
|
<link rel="preload" href="/runtime~main.8b0a13bd.js" as="script">
|
|
|
|
<link rel="preload" href="/main.897ec4ff.js" as="script">
|
|
|
|
<link rel="preload" href="/1.d3d3a670.js" as="script">
|
|
|
|
<link rel="preload" href="/2.ffeb03e1.js" as="script">
|
|
|
|
<link rel="preload" href="/1be78505.e2c6fec8.js" as="script">
|
|
|
|
<link rel="preload" href="/20ac7829.d70ea65c.js" as="script">
|
|
|
|
<link rel="preload" href="/17896441.76bc76a9.js" as="script">
|
|
|
|
<link rel="preload" href="/f3f9be1d.9300b628.js" as="script">
|
|
|
|
</head>
|
|
<body>
|
|
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=window.matchMedia("(prefers-color-scheme: dark)"),n=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();null!==n?t(n):e.matches&&t("dark")}()</script>
|
|
<div id="__docusaurus">
|
|
<nav class="navbar navbar--light navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a aria-current="page" class="navbar__brand active" href="/"><img class="navbar__logo" src="/img/logo-circle.png" alt="NodeGui Logo"><strong class="navbar__title">NodeGui</strong></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/docs/guides/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/api/manual/synopsis">API</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a class="navbar__item navbar__link" target="_blank" rel="noopener noreferrer" href="https://github.com/nodegui/nodegui">GitHub</a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_1gtM"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_keGJ moon_1gwN"></span></div><div class="react-toggle-track-x"><span class="toggle_keGJ sun_3CPA"></span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a aria-current="page" class="navbar__brand active" href="/"><img class="navbar__logo" src="/img/logo-circle.png" alt="NodeGui Logo"><strong class="navbar__title">NodeGui</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/guides/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/api/manual/synopsis">API</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a class="menu__link" target="_blank" rel="noopener noreferrer" href="https://github.com/nodegui/nodegui">GitHub</a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_1kjD"><div class="docSidebarContainer_1cYp"><div class="sidebar_1kLs"><div class="sidebarLogo_3ono"><img src="/img/logo-circle.png" alt="NodeGui Logo"><strong>NodeGui</strong></div><div class="menu menu--responsive menu_w2sC"><button aria-label="Open Menu" class="button button--secondary button--sm menu__button" type="button"><svg class="sidebarMenuIcon_2vk4" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 32 32" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">The Basics</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/guides/getting-started">Getting started</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/tutorial">Learn the Basics</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/styling">Styling</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/layout">Layout</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/handle-events">Handle Events</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/scroll-view">Scroll View</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/images">Images</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/networking">Networking</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">Guides</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/guides/nodegui-architecture">Architecture</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/guides/debugging">Debugging</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/debugging-in-vscode">Debugging in VSCode</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/using-native-node-modules">Native Node Modules</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/guides/custom-nodegui-native-plugin">Custom NodeGui Plugin</a></li></ul></li></ul></div></div></div><main class="docMainContainer_FFX1"><div class="padding-vert--lg"><div class="container"><div class="row"><div class="col docItemCol_2GOA"><div class="docItemContainer_2cwg"><article><header><h1 class="docTitle_1vWb">Debugging</h1></header><div class="markdown"><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="application-debugging"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#application-debugging" title="Direct link to heading">#</a>Application Debugging</h2><p>Whenever your NodeGui application is not behaving the way you wanted it to,
|
|
an array of debugging tools might help you find coding errors, performance
|
|
bottlenecks, or optimization opportunities.</p><p>Since a NodeGui application runs on Qode. And Qode is essentially NodeJs. We can consider a NodeGui app as a regular NodeJs app. Hence, you can use any debugging tool that you use with NodeJs
|
|
One of the most popular ways of debugging a NodeJs app is by making use of the <a href="https://nodejs.org/en/docs/inspector/">Chromium Developer Tools</a>.</p><p>Google offers <a href="https://developer.chrome.com/devtools">excellent documentation for their developer tools</a>.
|
|
We recommend that you make yourself familiar with them - they are usually one
|
|
of the most powerful utilities in any NodeGui Developer's tool belt.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="debugging-qode-process"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#debugging-qode-process" title="Direct link to heading">#</a>Debugging Qode process</h2><p>To debug JavaScript that's executed in the Qode/Node process you will need to use an external debugger and
|
|
launch Qode with the <code>--inspect</code> or <code>--inspect-brk</code> switch. Once you run it you can open up Chrome and visit <code>chrome://inspect</code> where you should see your app listed.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="command-line-switches"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#command-line-switches" title="Direct link to heading">#</a>Command Line Switches</h3><p>Use one of the following command line switches to enable debugging of the process:</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="--inspectport"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#--inspectport" title="Direct link to heading">#</a><code>--inspect=[port]</code></h4><p>Qode will listen for V8 inspector protocol messages on the specified <code>port</code>,
|
|
an external debugger will need to connect on this port. The default <code>port</code> is
|
|
<code>9229</code>.</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-shell codeBlock_19pQ"><button type="button" aria-label="Copy code to clipboard" class="copyButton_1BYj">Copy</button><code class="codeBlockLines_2n9r" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">qode --inspect</span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token number" style="color:rgb(247, 140, 108)">9229</span><span class="token plain"> your/app</span></div></code></pre></div><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="--inspect-brkport"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#--inspect-brkport" title="Direct link to heading">#</a><code>--inspect-brk=[port]</code></h4><p>Like <code>--inspect</code> but pauses execution on the first line of JavaScript.</p><p><strong>Note</strong></p><p>If you are using the official boilerplate <code>nodegui-starter</code>, then you can achieve this by running</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-undefined codeBlock_19pQ"><button type="button" aria-label="Copy code to clipboard" class="copyButton_1BYj">Copy</button><code class="codeBlockLines_2n9r" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm run debug</span></div></code></pre></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="external-debuggers"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#external-debuggers" title="Direct link to heading">#</a>External Debuggers</h3><p>You will need to use a debugger that supports the V8 inspector protocol.</p><ul><li>Connect Chrome by visiting <code>chrome://inspect</code> and selecting to inspect the
|
|
launched NodeGui app present there.</li><li><a href="/docs/guides/debugging-in-vscode">Debugging the NodeGui app in VSCode</a></li></ul></div></article><div class="margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/nodegui/nodegui/edit/master/website/docs/guides/debugging.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 40 40" style="margin-right:0.3em;vertical-align:sub"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/guides/nodegui-architecture"><h5 class="pagination-nav__link--sublabel">Previous</h5><h4 class="pagination-nav__link--label">« Architecture</h4></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/guides/debugging-in-vscode"><h5 class="pagination-nav__link--sublabel">Next</h5><h4 class="pagination-nav__link--label">Debugging in VSCode »</h4></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_TbNY"><ul class="contents contents__left-border"><li><a href="#application-debugging" class="contents__link">Application Debugging</a></li><li><a href="#debugging-qode-process" class="contents__link">Debugging Qode process</a><ul><li><a href="#command-line-switches" class="contents__link">Command Line Switches</a></li><li><a href="#external-debuggers" class="contents__link">External Debuggers</a></li></ul></li></ul></div></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/guides/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/api/manual/synopsis">API</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" target="_blank" rel="noopener noreferrer" href="https://spectrum.chat/nodegui">Spectrum</a></li><li class="footer__item"><a class="footer__link-item" target="_blank" rel="noopener noreferrer" href="https://nodegui.slack.com">Slack</a></li><li class="footer__item"><a class="footer__link-item" to="https://twitter.com/node_gui" href="https://twitter.com/node_gui">Twitter</a></li><li class="footer__item"><a class="footer__link-item" to="https://medium.com/nodegui" href="https://medium.com/nodegui">Medium</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a class="footer__link-item" to="https://react.nodegui.org" href="https://react.nodegui.org">React NodeGui</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/faq">FAQ</a></li></ul></div></div><div class="text--center"><div>Copyright © 2020 NodeGui</div></div></div></footer>
|
|
</div>
|
|
|
|
<script src="/styles.edba8c47.js"></script>
|
|
|
|
<script src="/runtime~main.8b0a13bd.js"></script>
|
|
|
|
<script src="/main.897ec4ff.js"></script>
|
|
|
|
<script src="/1.d3d3a670.js"></script>
|
|
|
|
<script src="/2.ffeb03e1.js"></script>
|
|
|
|
<script src="/1be78505.e2c6fec8.js"></script>
|
|
|
|
<script src="/20ac7829.d70ea65c.js"></script>
|
|
|
|
<script src="/17896441.76bc76a9.js"></script>
|
|
|
|
<script src="/f3f9be1d.9300b628.js"></script>
|
|
|
|
|
|
</body>
|
|
</html> |