nodeguy/docs/guides/getting-started/index.html

93 lines
21 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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">Getting started | 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="NodeGui enables you to create desktop applications with JavaScript. You could see it"><meta data-react-helmet="true" property="og:description" content="NodeGui enables you to create desktop applications with JavaScript. You could see it"><meta data-react-helmet="true" property="og:url" content="https://nodegui.org/docs/guides/getting-started">
<link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico">
<link rel="stylesheet" href="/styles.5d0c291d.css">
<link rel="preload" href="/styles.146e6ed6.js" as="script">
<link rel="preload" href="/runtime~main.d1a61ae1.js" as="script">
<link rel="preload" href="/main.a6888cc2.js" as="script">
<link rel="preload" href="/1.f2aa7dd6.js" as="script">
<link rel="preload" href="/2.aa533a9f.js" as="script">
<link rel="preload" href="/3.b4bd37b1.js" as="script">
<link rel="preload" href="/1be78505.04d92b35.js" as="script">
<link rel="preload" href="/20ac7829.d0dd5719.js" as="script">
<link rel="preload" href="/17896441.ec5e01fd.js" as="script">
<link rel="preload" href="/c9ea0dcf.72f0020e.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 aria-current="page" class="navbar__item navbar__link navbar__link--active" 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 aria-current="page" class="menu__link navbar__link--active" 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"><a class="menu__link menu__link--sublist menu__link--active" href="#!">The Basics</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" 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 menu__list-item--collapsed"><a class="menu__link menu__link--sublist" 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 class="menu__link" 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">Getting started</h1></header><div class="markdown"><p>NodeGui enables you to create desktop applications with JavaScript. You could see it
as a lightly modified variant of the Node.js runtime that is focused on desktop applications
instead of web servers.</p><p>NodeGui is also an efficient JavaScript binding to a cross platform graphical user interface
(GUI) library <code>Qt</code>. Qt is one of the most mature and efficient library for building desktop applications.
This enabled NodeGui to be extrememly memory and CPU efficient as compared to other popular Javascript Desktop GUI solutions. A hello world app built with NodeGui runs on less than 20Mb of memory.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="developer-environment"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#developer-environment" title="Direct link to heading">#</a>Developer environment</h2><p>To turn your operating system into an environment capable of building desktop apps with NodeGui, you would need Node.js, npm,a code editor of your choice, and a rudimentary understanding of your operating system&#x27;s command line client.</p><p>Along with these, there are a few operating system dependent instructions that are listed below.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="setting-up-on-macos"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#setting-up-on-macos" title="Direct link to heading">#</a>Setting up on macOS</h3><p><strong>Requirements:</strong></p><ul><li>NodeGui supports macOS 10.10 (Yosemite) and up. NodeGui currently only supports 64bit OS.</li><li>CMake 3.1 and up (Installation instructions can be found here: <a href="https://cmake.org/install/">https://cmake.org/install/</a>)</li><li>Make, GCC v7</li><li>Currently supported Node.Js versions are 12.x and up.</li></ul><p>We strongly suggest you use some kind of version manager for Node.Js. This would allow you to switch to any version of nodejs quite easily. We recommend <code>nvm</code>: <a href="https://github.com/nvm-sh/nvm">https://github.com/nvm-sh/nvm</a></p><p>Confirm that both <code>node</code> and <code>npm</code> are available by running:</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-sh 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"># This command should print the version of Node.js</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">node -v</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"># This command should print the version of npm</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm -v</span></div></code></pre></div><p>If both commands printed a version number, you are all set! Before you get
started, you might want to install a <a href="#a-good-editor">code editor</a> suited
for JavaScript development.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="setting-up-on-windows"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#setting-up-on-windows" title="Direct link to heading">#</a>Setting up on Windows</h3><blockquote><p>NodeGui supports Windows 7 and later versions  attempting to develop NodeGui
applications on earlier versions of Windows might not work. NodeGui currently only supports 64bit OS.</p></blockquote><p><strong>Requirements:</strong></p><ul><li>Visual studio 2017 and up.</li><li>CMake 3.1 and up (Installation instructions can be found here: <a href="https://cmake.org/install/">https://cmake.org/install/</a>)</li><li>Currently supported Node.Js versions are 12.x and up.</li></ul><p>We strongly suggest you use some kind of version manager for Node.Js. This would allow you to switch to any version of nodejs quite easily.</p><p>We strongly recommend Powershell as preferred terminal in Windows.</p><p>Confirm that both <code>node</code> and <code>npm</code> are available by running:</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-powershell 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"># This command should print the version of Node.js</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">node -v</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"># This command should print the version of npm</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm -v</span></div></code></pre></div><p>If both commands printed a version number, you are all set! Before you get
started, you might want to install a <a href="#a-good-editor">code editor</a> suited
for JavaScript development.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="setting-up-on-linux"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#setting-up-on-linux" title="Direct link to heading">#</a>Setting up on Linux</h3><blockquote><p>NodeGui currently supports Ubuntu 16.04 and Debian 10 and up. Although other Linux distributions can also be easily supported. NodeGui currently only supports 64bit OS.</p></blockquote><p><strong>Requirements:</strong></p><ul><li>Make, GCC v7</li><li>CMake 3.1 and up (Installation instructions can be found here: <a href="https://cmake.org/install/">https://cmake.org/install/</a>)</li><li>Currently supported Node.Js versions are 12.x and up.</li><li>On Ubuntu and Ubuntu-based distros it is advisable to run <code>sudo apt-get update</code>, followed by <code>sudo apt-get install pkg-config build-essential</code></li></ul><p>We strongly suggest you use some kind of version manager for Node.Js. This would allow you to switch to any version of nodejs quite easily. We recommend <code>nvm</code>: <a href="https://github.com/nvm-sh/nvm">https://github.com/nvm-sh/nvm</a></p><p>Confirm that both <code>node</code> and <code>npm</code> are available by running:</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-sh 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"># This command should print the version of Node.js</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">node -v</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"># This command should print the version of npm</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm -v</span></div></code></pre></div><p>If both commands printed a version number, you are all set! Before you get
started, you might want to install a <a href="#a-good-editor">code editor</a> suited
for JavaScript development.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="a-good-editor"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#a-good-editor" title="Direct link to heading">#</a>A Good Editor</h3><p>We might suggest two free popular editors:
GitHub&#x27;s <a href="https://atom.io/">Atom</a> and Microsoft&#x27;s <a href="https://code.visualstudio.com/">Visual Studio Code</a>. Both of
them have excellent JavaScript support.</p><p>If you are one of the many developers with a strong preference, know that
virtually all code editors and IDEs these days support JavaScript.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="hello-world"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#hello-world" title="Direct link to heading">#</a>Hello World</h3><p>Clone and run the code in this tutorial by using the
<a href="https://github.com/nodegui/nodegui-starter"><code>nodegui/nodegui-starter</code></a> repository.</p><p><strong>Note</strong>: Running this requires <a href="https://git-scm.com">Git</a> and <a href="https://www.npmjs.com/">npm</a>.</p><div class="mdxCodeBlock_iHAB"><pre class="prism-code language-sh 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" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">git clone https://github.com/nodegui/nodegui-starter</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">cd nodegui-starter</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm install</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">npm start</span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block">
</span></div></code></pre></div><p>That&#x27;s it!</p><p>Congratulations! You&#x27;ve successfully run and modified your first NodeGui app.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="now-what"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#now-what" title="Direct link to heading">#</a>Now what?</h3><p>If you&#x27;re curious to learn more about NodeGui, continue on to the <a href="/docs/guides/tutorial">tutorial</a>.</p></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/getting-started.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"></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/guides/tutorial"><h5 class="pagination-nav__link--sublabel">Next</h5><h4 class="pagination-nav__link--label">Learn the Basics »</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="#developer-environment" class="contents__link">Developer environment</a><ul><li><a href="#setting-up-on-macos" class="contents__link">Setting up on macOS</a></li><li><a href="#setting-up-on-windows" class="contents__link">Setting up on Windows</a></li><li><a href="#setting-up-on-linux" class="contents__link">Setting up on Linux</a></li><li><a href="#a-good-editor" class="contents__link">A Good Editor</a></li><li><a href="#hello-world" class="contents__link">Hello World</a></li><li><a href="#now-what" class="contents__link">Now what?</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 aria-current="page" class="footer__link-item active" 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" 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.146e6ed6.js"></script>
<script src="/runtime~main.d1a61ae1.js"></script>
<script src="/main.a6888cc2.js"></script>
<script src="/1.f2aa7dd6.js"></script>
<script src="/2.aa533a9f.js"></script>
<script src="/3.b4bd37b1.js"></script>
<script src="/1be78505.04d92b35.js"></script>
<script src="/20ac7829.d0dd5719.js"></script>
<script src="/17896441.ec5e01fd.js"></script>
<script src="/c9ea0dcf.72f0020e.js"></script>
</body>
</html>