{"componentChunkName":"component---src-templates-category-js","path":"/category/node-js/page/5","result":{"data":{"allContentfulPost":{"edges":[{"node":{"slug":"need-to-node-volume-65","title":"Need to Node – Volume 65","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/VFeeEm280FxoAGqYdliFg/0bd19fd5585434f09c59803c90114a61/4-min.png","fileName":"4-min.png"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>In this volume of Need to Node, you can find the latest news on Node.js’s v13.12.0 (Current) Release, Diagnostics in Node.js and a practical guide to memory leaks in Node.js.</p>\n<p>Need to Node is a weekly bulletin designed to keep you up-to-date with the latest news on the Node.js project, events and articles. You are always welcome to collaborate and participate. Please let us know if we missed a piece of content you think should be included!</p>\n<h2>What’s New in the Node.js Project</h2>\n<ul>\n<li>Discussing changes to <a href=\"https://github.com/nodejs/Release/issues/553\">Node's Release Cadence</a> due to the COVID-19 pandemic. This issue contains a discussion if the release date should be postponed. For now it will remain the same: 2020-04-21.</li>\n<li><a href=\"https://nodejs.org/en/blog/release/v13.12.0/\">Node v13.12.0 (Current) Released</a>  In addition to the usual dependency updates (npm to 6.14.4, libuv to 1.35.0), diagnostic reports are now considered stable, and Node’s macOS binaries are now compiled in a way that supports notarization.</li>\n<li>Node 14.0.0 Release Candidate 1. You can find the latest Node.js v14 downloads <a href=\"https://nodejs.org/download/rc/v14.0.0-rc.1/\">here</a> . Final release of 14 as the new ‘current’ release is due in a few weeks. Node 14 should then become LTS in October.</li>\n</ul>\n<h2>Awesome Articles, Links, and Resources</h2>\n<ul>\n<li><a href=\"https://nodesource.com/blog/diagnostics-in-NodeJS-1\">Diagnostics in Node.js Part 1</a>, useful techniques for diagnostics in Node.js - by <a href=\"https://twitter.com/lizparody23\">lizparody</a></li>\n<li><a href=\"https://tsh.io/state-of-microservices/\">State of Microservices 2020</a> Scalability and performance are the two most important topics when it comes to microservices. Don’t miss this report based on a survey conducted among 650+ tech leaders around the world!</li>\n<li><a href=\"https://www.youtube.com/watch?v=jWsDPyHrJho\">Contributing to Node.js Core</a> In this excellent stream, <a href=\"https://twitter.com/edsadr\">Adrian Estrada</a> and <a href=\"https://twitter.com/julian_duque\">Julian Duque</a> share how to start contributing to Node.js. Don’t miss it, especially if you speak spanish and like Node.js! </li>\n<li><a href=\"https://www.asyncapi.com/blog/automated-releases/\">Automating releases with GitHub Actions and Docker Hub</a> Repetitive tasks are tedious. If what you do manually can be automated, then what are you waiting for! In this article you can learn how to automate releases using npm, Docker Hub and GitHub actions. By <a href=\"https://twitter.com/derberq?lang=en\">Lukasz Gornicki</a></li>\n<li><a href=\"https://blog.logrocket.com/integrating-typescript-graphql/\">Integrating TypeScript with GraphQL</a> A thorough tutorial on using the TypeGraphQL library to build GraphQL APIs in Node.js while leaning on TypeScript’s features. By <a href=\"https://blog.logrocket.com/author/alexandernnakwue/\">Alexander Nnakwue</a></li>\n<li><a href=\"https://www.arbazsiddiqui.me/a-practical-guide-to-memory-leaks-in-nodejs/\">A Practical Guide to Memory Leaks in Node.js</a> Memory leaks are the parasites of applications. They creep up into your systems unnoticed, don't cause any harm initially, but once they are strong enough, they can cause catastrophic problems. These include high latencies ,crashes, etc. This article helps you understand memory leaks and how to fix them. Don’t miss it. By <a href=\"https://www.arbazsiddiqui.me/\">Arbaz Siddiqui</a></li>\n</ul>\n<h2>One Last Thing...</h2>\n<p>If you find any Node.js or JavaScript related content over the next week (or beyond!), never hesitate to reach out to us on Twitter at<a href=\"https://twitter.com/nodesource\">@NodeSource</a> to share and get it included in Need to Node - our DMs are open if you don’t want to share publicly!</p>"}},"categories":[{"name":"Community","slug":"community"},{"name":"Node.js","slug":"node-js"}]}},{"node":{"slug":"an-absolute-beginners-guide-to-using-npm","title":"An Absolute Beginner's Guide to Using npm","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/4WoWwInHFOX8VDxo4SrKEe/e64a0fd1d6b95ff693739264037373ac/18-min.jpg","fileName":"18-min.jpg"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>This article was first published in <a href=\"https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/\">NodeSource blog</a> on February 2017.</p>\n<hr>\n<p>Using npm effectively is a cornerstone of modern web development, no matter if it's exclusively with Node.js, as a package manager or build tool for the front-end, or even as a piece of workflows in other languages and on other platforms.</p>\n<p><em>Really</em> understanding npm as a tool, understanding the core concepts, can be something that's difficult for a beginner - I spent many hours just trying to figure out small details that would seem minor or be taken for granted by others. </p>\n<p>As such, I've written up a basic and <strong>detailed</strong> guide for understanding npm, for those who are entirely new to Node.js, npm, and the surrounding ecosystem.</p>\n<h2>An Absolute Beginner's Guide to <code>package.json</code></h2>\n<p>As a general rule, any project that's using Node.js will need to have a <code>package.json</code> file. What is a <code>package.json</code> file?</p>\n<p>At its simplest, a <code>package.json</code> file can be described as a manifest of your project that includes the packages and applications it depends on, information about its unique source control, and specific metadata like the project's name, description, and author.</p>\n<p>Let's break down the core parts of a typical <code>package.json</code> file:</p>\n<h3>Specific Metadata: name, version, description, license, and keywords</h3>\n<p>Inside a package.json, you'll almost always find metadata specific to the project - no matter if it's a web application, Node.js module, or even just a plain JavaScirpt library. This metadata helps identify the project and acts as a baseline for users and contributors to get information about the project.</p>\n<p>Here's an example of how these fields would look in a package.json file:</p>\n<pre><code class=\"language-json\">{\n  \"name\": \"metaverse\", // The name of your project\n  \"version\": \"0.92.12\", // The version of your project\n  \"description\": \"The Metaverse virtual reality. The final outcome of all virtual worlds, augmented reality, and the Internet.\", // The description of your project\n  \"main\": \"index.js\"\n  \"license\": \"MIT\" // The license of your project\n}\n</code></pre>\n<p>A <code>package.json</code> file is <em>always</em> structured in the <a href=\"http://www.json.org/\">JSON</a> format, which allows it to be easily read as metadata and parsed by machines. </p>\n<p>If needing to format a <code>package.json</code> file manually to get your project up and running seems a bit daunting, there's a handy command that will automatically generate a base <code>package.json</code> file for you - if you'd like to learn how to use it, take a peek at the <code>npm init</code> instructions below!</p>\n<h3>Understanding and Managing Your Project's Dependencies: <code>dependencies</code> and <code>devDepenendcies</code> in your <code>package.json</code></h3>\n<p>The other majorly important aspect of a <code>package.json</code> is that it contains a collection of any given project's dependencies. These dependencies are the modules that the project relies on to function properly. </p>\n<p>Having dependencies in your project's <code>package.json</code> allows the project to install the versions of the modules it depends on. By running an install command (see the instructions for <code>npm install</code> below) inside of a project, you can install <em>all</em> of the dependencies that are listed in the project's <code>package.json</code> - meaning they don't have to be (and almost never should be) bundled with the project itself.</p>\n<p>Second, it allows the separation of dependencies that are needed for production and dependencies that are needed for development. In production, you're likely not going to need a tool to watch your CSS files for changes and refresh the app when they change. But in both production and development, you'll want to have the modules that enable what you're trying to accomplish with your project - things like your web framework, API tools, and code utilities.</p>\n<p>What would a project's <code>package.json</code> look like with <code>dependencies</code> and <code>devDependencies</code>? Let's expand on the previous example of a <code>package.json</code> to include some.</p>\n<pre><code class=\"language-json\">{\n  \"name\": \"metaverse\",\n  \"version\": \"0.92.12\",\n  \"description\": \"The Metaverse virtual reality. The final outcome of all virtual worlds, augmented reality, and the Internet.\",\n  \"main\": \"index.js\"\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"mocha\": \"~3.1\",\n    \"native-hello-world\": \"^1.0.0\",\n    \"should\": \"~3.3\",\n    \"sinon\": \"~1.9\"\n  },\n  \"dependencies\": {\n    \"fill-keys\": \"^1.0.2\",\n    \"module-not-found-error\": \"^1.0.0\",\n    \"resolve\": \"~1.1.7\"\n  }\n}\n</code></pre>\n<p>One key difference between the dependencies and the other common parts of a <code>package.json</code> is that they're both objects, with multiple key/value pairs. Every key in both <code>dependencies</code> and <code>devDependencies</code> is a name of a package, and every value is the version range that's acceptable to install (according to Semantic Versioning - to learn more about Semantic Versioning, also known as semver, check out our <a href=\"https://nodesource.com/blog/semver-a-primer/\">primer on semver</a>).</p>\n<div class=\"blog-cta nsolid\" style=\"background-color: #4cb5ff;\">\n\tCan't get enough npm? Download our complete guide: \n  <a class=\"button more large\" href=\"https://pages.nodesource.com/npm-guide-ultimate-wb.html?utm_campaign=blogref&utm_source=blog&utm_content=blog-beginners\">Read now: The Ultimate Guide to npm</a>\n</div>\n<h2>The Essential npm Commands</h2>\n<p>When using npm, you're most likely going to be using the command line tool for the majority of your interactions. As such, here's a detailed rundown of the commands that you'll encounter and need to use most frequently.</p>\n<h2>Using <code>npm init</code> to Initialize a Project</h2>\n<p>The <code>npm init</code> command is a step-by-step tool to scaffold out your project. It will prompt you for input for a few aspects of the project in the following order:</p>\n<ul>\n<li>The project's name,</li>\n<li>The project's initial version,</li>\n<li>The project's description,</li>\n<li>The project's entry point (meaning the project's main file),</li>\n<li>The project's test command (to trigger testing with something like <a href=\"https://github.com/feross/standard\">Standard</a>)</li>\n<li>The project's git repository (where the project source can be found)</li>\n<li>The project's keywords (basically, tags related to the project)</li>\n<li>The project's license (this defaults to ISC - most open-source Node.js projects are MIT)</li>\n</ul>\n<p>It's worth noting that if you're content with the <em>suggestion</em> that the <code>npm init</code> command provides next to the prompt, you can simply hit <code>Return</code> or <code>Enter</code> to accept the suggestion and move on to the next prompt.</p>\n<p>Once you run through the <code>npm init</code> steps above, a <code>package.json</code> file will be generated and placed in the current directory. If you run it in a directory that's not exclusively for your project, don't worry! Generating a <code>package.json</code> doesn't really <em>do</em> anything, other than create a <code>package.json</code> file. You can either move the <code>package.json</code> file to a directory that's dedicated to your project, <em>or</em> you can create an entirely new one in such a directory.</p>\n<h4>How to use <code>npm init</code>:</h4>\n<pre><code>npm init # This will trigger the initialization\n</code></pre>\n<h3>Using <code>npm init --yes</code> to <em>Instantly</em> Initialize a Project</h3>\n<p>If you want to get on to building your project, and don't want to spend the (albeit brief) time answering the prompts that come from <code>npm init</code>, you can use the <code>--yes</code> flag on the <code>npm init</code> command to automatically populate all options with the default <code>npm init</code> values.</p>\n<blockquote>\n<p><strong>Note:</strong> You can configure what these default values are with the npm configuration - that's a more advanced topic, and outside the scope of this beginner's guide to npm. </p>\n<p>That said, if you're interested in setting that up, you can learn how to set these defaults in the eleventh tip of our <a href=\"https://nodesource.com/blog/eleven-npm-tricks-that-will-knock-your-wombat-socks-off\">npm tricks</a> article.</p>\n</blockquote>\n<h4>Usage:</h4>\n<pre><code>npm init --yes # This will trigger automatically populated initialization.\n</code></pre>\n<h2>Install Modules with <code>npm install</code></h2>\n<p>Installing modules from npm is one of the most basic things you should learn to do when getting started with npm.  As you dive deeper, you'll begin to learn some variations on installing modules, but here's the very core of what you need to know to install a standalone module into the current directory:</p>\n<pre><code>npm install &#x3C;module>\n</code></pre>\n<p>In the above command, you'd replace <code>&#x3C;module></code> with the name of the module you want to install. For example, if you want to install Express (the most used and most well known Node.js web framework), you could run the following command:</p>\n<pre><code>npm install express\n</code></pre>\n<p>The above command will install the <code>express</code> module into <code>/node_modules</code> in the current directory. Whenever you install a module from npm, it will be installed <em>into</em> the <code>node_modules</code> folder.</p>\n<p>In addition to triggering an install of a single module, you can actually trigger the installation of <em>all</em> modules that are listed as <code>dependencies</code> and <code>devDependencies</code> in the <code>package.json</code> in the current directory. To do so, you'll simply need to run the command itself:</p>\n<pre><code>npm install\n</code></pre>\n<p>Once you run this, npm will begin the installation process of all of the current project's dependencies. </p>\n<p>As an aside, one thing to note is that there's an alias for <code>npm install</code> that you may see in the wild when working with modules from the ecosystem. The alias is <code>npm i</code>, where <code>i</code> takes the place of <code>install</code>. </p>\n<p>This seemingly minor alias is a small gotcha for beginners - including myself, several times when I was learning - to the Node.js and npm ecosystems, as there's not a standardized, single way that module creators and maintainers will instruct on how to install their module.</p>\n<h4>Usage:</h4>\n<pre><code class=\"language-bash\">npm install &#x3C;module> # Where &#x3C;module> is the name of the module you want to install\nnpm i &#x3C;module> # Where &#x3C;module> is the name of the module you want to install - using the i alias for installation\n</code></pre>\n<h3>Install modules and save them to your <code>package.json</code> as a dependency</h3>\n<p>As with <code>npm init</code>, the <code>npm install</code> command has a flag or two that you'll find useful in your workflow - it'll save you time and effort with regard to your project's <code>package.json</code> file.</p>\n<p>When you're running <code>npm install</code> to install a module, you can add the optional flag <code>--save</code> to the command. This flag will add the module as a dependency of your project to the project's <code>package.json</code> as an entry in <code>dependencies</code>. </p>\n<h4>Usage:</h4>\n<pre><code>npm install &#x3C;module> --save # Where &#x3C;module> is the name of the module you want to install\n</code></pre>\n<h3>Install Modules and Save Them to Your <code>package.json</code> as a Developer dependency</h3>\n<p>There's a flag that is nearly an exact duplicate, in terms of functionality, of the <code>--save</code> flag when installing a module: <code>--save-dev</code>. There are a few a key differences between the two - instead of saving the module being installed and added to <code>package.json</code> as an entry in <code>dependencies</code>, it will save it as an entry in the <code>devDependencies</code>. </p>\n<p>The semantic difference here is that <code>dependencies</code> are for use in production - whatever that would entail for your project. On the other hand, <code>devDependencies</code> are a collection of the dependencies that are used in <em>development</em> of your application - the modules that you use to build it, but don't need to use when it's <em>running</em>. This could include things like testing tools, a local server to speed up your development, and more.</p>\n<h4>Usage:</h4>\n<pre><code>npm install &#x3C;module> --save-dev # Where &#x3C;module> is the name of the module you want to install\n</code></pre>\n<h3>Install Modules Globally on your System</h3>\n<p>The final, and most common, flag for <code>npm install</code> that you should are the flags to install a module globally on your system. </p>\n<p>Global modules can be extremely useful - there are tons tools, utilities, and more for both development and general usage that you can install globally to use. </p>\n<p>To install a module from npm globally, you'll simply need to use the <code>--global</code> flag when running the install command to have the module install globally, rather than locally (to the current directory).</p>\n<blockquote>\n<p><strong>Note:</strong> One caveat with global modules is that, by default, npm will install them to a system directory, not a local one. With this as the default, you'll need to authenticate as a privileged user on your system to install global modules.</p>\n<p>As a best practice, you should change the default installation location from a system directory to a user directory. If you'd like to learn to do this, take a peek at the seventh tip in our <a href=\"https://nodesource.com/blog/eleven-npm-tricks-that-will-knock-your-wombat-socks-off\">npm tricks</a> article!</p>\n</blockquote>\n<h4>Usage:</h4>\n<pre><code class=\"language-bash\">npm install &#x3C;module> --global # Where &#x3C;module> is the name of the module you want to install globally\nnpm install &#x3C;module> -g # Where &#x3C;module> is the name of the module you want to install globally, using the -g alias\n</code></pre>\n<h2>Want to keep going?</h2>\n<p>If you want to keep learning about npm and all its facets, I've got a few awesome things for you. A bit ago, we shared a few <a href=\"https://nodesource.com/blog/eleven-npm-tricks-that-will-knock-your-wombat-socks-off\">npm tricks to knock your wombat socks off</a>. Even better, we wrote a follow-up with <a href=\"https://nodesource.com/blog/seven-more-npm-tricks-to-knock-your-wombat-socks-off\">even more npm tricks</a>! This beginner's guide is a great springboard to get off the ground, and both of those will help you start optimizing your work with npm! If you'd like to go even further with npm and start deploying Node.js apps and npm modules into production, you should <em>definitely</em> take a look at <a href=\"https://certified.nodesource.com/\">NodeSource Certified Modules</a> - it's an awesome tool that'll compliment your newly acquired npm skills!</p>"}},"categories":[{"name":"How To","slug":"how-to"},{"name":"Tutorials","slug":"tutorials"},{"name":"Node.js","slug":"node-js"}]}},{"node":{"slug":"installing-nodejs-tutorial-windows","title":"Installing Node.js Tutorial: Windows","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/2Znvdbgm4tqquT6w7uWdXa/8c486f23dddaefad8a54dbb0463919ee/17-min.jpg","fileName":"17-min.jpg"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>This article was first published in <a href=\"https://nodesource.com/blog/installing-nodejs-tutorial-windows/\">NodeSource blog</a> on February 2017.</p>\n<hr>\n<p>As with any programming language, platform, or tool that doesn't come bundled with Windows, getting up and running with Node.js takes some initial setup before you can start hacking away. In my experience, though Node.js has a far better installation experience on Windows than virtually any other language, platform, or tool that I've tried to use - just run the installer, and you're good to go.</p>\n<p>In this quick tutorial, we'll take a look at how to get Node.js installed on Windows. Once we've completed the entirety of the tutorial, you'll be ready to take the next step with Node.js.</p>\n<p>This guide covers installing Node.js on the following versions of Windows: Windows 7, Windows 8, Windows 8.1, and Windows 10. These are the versions that are consistently tested and supported by the Node.js build process at the time of writing.</p>\n<h2>Step 0: The Quick Guide (TL;DR) to Get Node.js Installed on Windows</h2>\n<p>Here's the abbreviated guide, highlighting the major steps:</p>\n<ol>\n<li>Open the official page for <a href=\"https://nodejs.org/en/download/\">Node.js downloads</a> and download Node.js for Windows by clicking the \"Windows Installer\" option</li>\n<li>\n<p>Run the downloaded Node.js <code>.msi</code> Installer - including accepting the license, selecting the destination, and authenticating for the install.</p>\n<ul>\n<li>This requires Administrator privileges, and you may need to authenticate</li>\n</ul>\n</li>\n<li>To ensure Node.js has been installed, run <code>node -v</code> in your terminal - you should get something like <code>v6.9.5</code></li>\n<li>Update your version of npm with <code>npm install npm --global</code></li>\n<li>This requires Administrator privileges, and you may need to authenticate</li>\n<li>Congratulations - you've now got Node.js installed, and are ready to start building! </li>\n</ol>\n<h2>Step 1: Download the Node.js <code>.msi</code> Installer</h2>\n<p>As the first step to installing Node.js on Windows, you'll need to download the installer. You'll be able to grab the installer from the <a href=\"https://nodejs.org/en/download/\">official downloads page for Node.js</a>. </p>\n<p>You'll be able to download the Windows Node.js installer by clicking the <code>Windows Installer</code> option at the top of the page - when you click this, you'll get an MSI installer download. Make sure to save it somewhere that you'll be able to find it!</p>\n<h2>Step 2: Run the Node.js Installer</h2>\n<p>You've got the Windows Installer - great! Now, you need to install it on your PC. The installer is a pretty typical Wizard interface for installing software on Windows - there are a few steps to it, but you can have it done in under a minute. You can get through it by following the guide below:</p>\n<ul>\n<li>\n<p>Welcome to the Node.js Setup Wizard</p>\n<ul>\n<li>Select <code>Next</code></li>\n</ul>\n</li>\n<li>\n<p>End-User License Agreement (EULA)</p>\n<ul>\n<li>Check <code>I accept the terms in the License Agreement</code></li>\n<li>Select <code>Next</code></li>\n</ul>\n</li>\n<li>\n<p>Destination Folder</p>\n<ul>\n<li>Select <code>Next</code></li>\n</ul>\n</li>\n<li>\n<p>Custom Setup</p>\n<ul>\n<li>Select <code>Next</code></li>\n</ul>\n</li>\n<li>\n<p>Ready to install Node.js</p>\n<ul>\n<li>Select <code>Install</code></li>\n<li><em>Note:</em> This step requires Administrator privlidges.</li>\n<li>If prompted, authenticate as an Administrator</li>\n</ul>\n</li>\n<li>\n<p>Installing Node.js</p>\n<ul>\n<li>Let the installer run to completion</li>\n</ul>\n</li>\n<li>\n<p>Completed the Node.js Setup Wizard</p>\n<ul>\n<li>Click <code>Finish</code></li>\n</ul>\n</li>\n</ul>\n<h1>Step 3: Verify that Node.js was Properly installed</h1>\n<p>To double check that Node.js was installed fully on your PC, you can test the following command in your Command Prompt (regardless of if you're using <code>cmd.exe</code>, <code>Powershell</code>, or any other command prompt):</p>\n<pre><code class=\"language-plain\">$ node -v\n</code></pre>\n<p>If Node.js was installed fully, the command prompt will print something similar to (but probably not <em>exactly</em>) this:</p>\n<pre><code class=\"language-plain\">$ node -v // The command we ran - prints out the version of Node.js that's currently installed \nv6.9.5 // The printed version of Node.js that's currently installed - v6.9.5 was the most current LTS release at the time of writing.\n</code></pre>\n<h1>Step 4: Update the Local npm Version</h1>\n<p>As the final step in getting Node.js installed, we'll update your version of npm - the package manager that comes bundled with Node.js.</p>\n<p>Node.js always ships with a specific version of npm - Node.js doesn't (and shouldn't!) automatically update npm. The release cycle of the npm CLI client isn't in sync with the Node.js releases. Because of this, there's almost <em>certainly</em> going to be a newer version of npm available than the one that is installed as a default in any given Node release.</p>\n<p>To quickly and easily update <code>npm</code>, you can run the following command:</p>\n<pre><code class=\"language-plain\">npm install npm --global // Update the `npm` CLI client\n</code></pre>\n<h2>Step 5: Go build applications, APIs, tools, and more with Node.js!</h2>\n<p>Now you've got Node.js on Windows machine. It's time to start exploring!</p>\n<p>Luckily, we've got your back. We've written a bunch of articles to help you get started with Node.js! If you're interested in exploring ES6, you should check out our article on <a href=\"https://nodesource.com/blog/six-of-the-most-exciting-es6-features-in-node-js-v6-lts\">some of the most exciting ES6 features in Node.js</a>. If you're interested in ways to collaborate with your team a bit better, you should check out our tutorial on <a href=\"https://nodesource.com/blog/streamline-javascript-development-with-eslint\">using ESLint in projects to improve team collaboration through code standards</a>. Maybe you'd just like to start deploying the applications you're about to build? In that case, take a peek at our guide on <a href=\"https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1\">how to deploy Node.js apps on Linux with systemd</a>!</p>\n<p>That said, if you want to keep in touch with Node.js and the surrounding ecosystem, you should go follow <a href=\"http://twitter.com/nodesource\">@NodeSource</a> on Twitter! We'll keep you updated with important news from the Node.js project, and share the best Node.js tutorials, guides, and tools that the community has to offer.</p>"}},"categories":[{"name":"How To","slug":"how-to"},{"name":"Tutorials","slug":"tutorials"},{"name":"Node.js","slug":"node-js"}]}},{"node":{"slug":"installing-nodejs-tutorial-mac-os-x","title":"Installing Node.js Tutorial: macOS","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/4Gb9yXc2CqRxOqGWgD4ulE/094c2774f665db490913466ff5cb5262/16-min.png","fileName":"16-min.png"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>Just like any programming language, platform, or library, getting up and running with Node.js takes some initial setup before you can start hacking away. With Node.js, the only initial setup required is, quite simply, getting the binary installed.</p>\n<p>In this quick tutorial, we'll take a quick look at how to get Node.js on macOS. Once we've completed the entirety of the tutorial, you'll be ready to take the next step with Node.js.</p>\n<p>This guide covers installing Node.js on the following versions of OS X and macOS: OS X 10.10 (Yosemite), OS X 10.11 (El Capitan), and macOS 10.11. These are the versions that are consistently tested and supported by the Node.js build process at the time of writing.</p>\n<h2>Step 0: The Quick Guide (TL;DR) to Get Node.js Installed on macOS</h2>\n<p>Here's the abbreviated guide, highlighting the major steps:</p>\n<ol>\n<li>Go to the <a href=\"https://nodejs.org/en/download/\">Node.js Downloads page</a></li>\n<li>Download Node.js for macOS by clicking the \"Macintosh Installer\" option</li>\n<li>Run the downloaded Node.js <code>.pkg</code> Installer</li>\n<li>Run the installer, including accepting the license, selecting the destination, and authenticating for the install.</li>\n<li>You're finished! To ensure Node.js has been installed, run <code>node -v</code> in your terminal - you should get something like <code>v6.9.4</code></li>\n</ol>\n<h2>Step 1: Download the Node.js <code>.pkg</code> Installer</h2>\n<p>As our first step, we need to actually <em>get</em> the official installer for Node.js on macOS. To do so, we can head over to the <a href=\"https://nodejs.org/en/download/\">Node.js Downloads page</a> to download the installer. </p>\n<p>You can get the macOS installer by clicking the <code>Macintosh Installer</code> option - this will download the <code>.pkg</code> installer for Node.js. Make sure you save it somewhere that you'll be able to access it!</p>\n<h2>Step 2: Run the Node.js Installer</h2>\n<p>Now that you've got the installer downloaded, you'll need to run it. The installer is a pretty typical interface - it won't take long to get through it (under a minute), even though there are a few parts to it. You can get through it by following the guide below:</p>\n<ul>\n<li>\n<p>Introduction</p>\n<ul>\n<li>Select <code>Continue</code></li>\n</ul>\n</li>\n<li>\n<p>License</p>\n<ul>\n<li>Select <code>Continue</code></li>\n<li>Select <code>Agree</code></li>\n</ul>\n</li>\n<li>\n<p>Installation Type</p>\n<ul>\n<li>Select <code>Install</code></li>\n<li>Authenticate with your Mac to allow the Installation</li>\n<li>Select <code>Install Software</code></li>\n</ul>\n</li>\n<li>\n<p>Summary</p>\n<ul>\n<li>Select <code>Close</code></li>\n</ul>\n</li>\n</ul>\n<h1>Step 3: Verify that Node.js was Properly installed</h1>\n<p>To verify that Node.js was installed correctly on your Mac, you can run the following command in your terminal:</p>\n<pre><code>$ node -v\n</code></pre>\n<p>If Node.js was properly installed, you'll see something close to (but probably not <em>exactly</em>) this:</p>\n<pre><code>$ node -v // The command we ran - tests the version of Node.js that's currently installed \nv6.9.4 // The version of Node.js that's installed - v6.9.4 was the most current LTS release at the time of writing.\n</code></pre>\n<h1>Step 4: Update Your npm Version</h1>\n<p>As one last step for good measure, we'll update your version of npm.</p>\n<p>Node.js always ships with a specific version of npm - Node.js doesn't (and shouldn't!) automatically update npm. The npm releases aren't synced with Node.js releases. Because of this, there's almost <em>always</em> a newer version of npm than the one that is installed by default with a given version of Node.</p>\n<p>To easily update your version of <code>npm</code>, you can run the following command:</p>\n<pre><code>$ sudo npm install npm --global // Update the `npm` CLI client\n</code></pre>\n<h2>Step 6: Start building with Node.js!</h2>\n<p>Now you've got Node.js on your Mac. It's time to start exploring!</p>\n<p>Thankfully, we've got your back. We've got a ton of articles on getting started with Node.js! If you're interested in exploring ES6, you should check out our article on <a href=\"https://nodesource.com/blog/six-of-the-most-exciting-es6-features-in-node-js-v6-lts\">some of the most exciting ES6 features in Node.js</a>. Looking for ways to standardize your JavaScript code across your team? In that case, you should check out our guide to <a href=\"https://nodesource.com/blog/streamline-javascript-development-with-eslint\">using ESLint to build code standards in Node.js applications</a>. Maybe you'd just like to start deploying your applications? In that case, check out our guide on <a href=\"https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1\">deploying Node.js apps with systemd</a>!</p>\n<p>That said, if you want to keep in touch with Node.js and the surrounding ecosystem, you should go follow <a href=\"http://twitter.com/nodesource\">@NodeSource</a> on Twitter! We'll keep you updated with important news from the Node.js project, and share the best Node.js tutorials, guides, and tools that the community has to offer!</p>"}},"categories":[{"name":"Node.js","slug":"node-js"},{"name":"How To","slug":"how-to"},{"name":"Tutorials","slug":"tutorials"}]}},{"node":{"slug":"need-to-node-volume-64","title":"Need to Node – Volume 64","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/4pkqP0mjoj4FuZpgYCTicI/06b9039051055aefb5796f9ee82a5e66/2-min.png","fileName":"2-min.png"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>In this volume of Need to Node, you can find the latest news on the Node.js v13.11.0 (Current) Release, npm is joining GitHub and Three Things You Didn't Know You Could Do with npm Scripts.</p>\n<p>Need to Node is a weekly bulletin designed to keep you up to date with the latest news on the Node.js project, events and awesome articles. You are always welcome to collaborate and participate. Please let us know if we missed a piece of content you think should be included!</p>\n<h2>What’s New in the Node.js Project</h2>\n<ul>\n<li>🚨 <a href=\"https://github.blog/2020-03-16-npm-is-joining-github/?utm_campaign=1584377606&#x26;utm_medium=social&#x26;utm_source=twitter&#x26;utm_content=1584377606\">npm is joining GitHub</a> 🙀.  On March 16th, Nat Friedman CEO of GitHub, announced that an agreement to acquire npm has been signed. The central  focus of the acquisition will be to (1) invest in the registry infrastructure and platform, (2) improve the core experience and (3) engage with the community. Check out the blog post!</li>\n<li><a href=\"https://github.com/nodejs/node/pull/32181\">The (Ongoing) Node 14.0 Pull Request</a> Check out what’s going on with the road to Node 14! The cut-off date for new features making it into this release is coming up later this month with the eventual release being due in late April (and running V8 8.1).</li>\n<li><a href=\"https://github.com/nodejs/node/releases/tag/v13.11.0\">Node 13.11.0 (Current) Released</a>. A minor release that includes updates in <code>async_hooks</code>, <code>cli</code> and <code>fs</code>.</li>\n</ul>\n<h2>Awesome Articles, Links, and Resources</h2>\n<ul>\n<li><a href=\"http://thecodebarbarian.com/building-a-github-app-with-node-js.html\">Building a GitHub App With Node.js</a>. In this article you can learn how to build a GitHub app that enforces pinning exact dependencies in your package.json: no <code>^</code>, <code>>=</code>, or <code>*</code> required. Exciting! By <a href=\"https://twitter.com/code_barbarian\">Valeri Karpov</a> </li>\n<li><a href=\"https://www.twilio.com/blog/npm-scripts\">Three Things You Didn't Know You Could Do with npm Scripts</a>. This article covers the basics of using npm scripts along with three features that are not widely used, but  might find useful in your workflow - by <a href=\"https://twitter.com/DKundel\">Domink Kundel</a></li>\n<li><a href=\"http://www.wirfs-brock.com/allen/posts/866\">JavaScript: The First 20 Years</a> <a href=\"https://twitter.com/awbjs\">Allen Wirfs-Brock</a> and <a href=\"https://twitter.com/BrendanEich\">Brendan Eich</a> (the creator of JavaScript) have written a paper for the forthcoming History of Programming Languages Conference about how JavaScript was built and has grown. It goes deep on the tech and syntax development side of things.</li>\n<li><a href=\"https://yunchi.dev/posts/demystifying-async/\">Demystifying Async Programming in Javascript</a> Asynchronous programming in Javascript has undergone several evolutions, from callbacks to promises to generators, and soon to async/await. Check out this article to find out more! By <a href=\"https://github.com/mightyguava\">Yunchi Luo</a></li>\n<li><a href=\"https://typeofnan.dev/what-is-a-higher-order-function/\">What is a Higher-Order Function?</a> A higher-order function is a function that either takes a function as an argument or returns a function. Don’t miss this blog post to learn more along with some useful examples! By <a href=\"https://twitter.com/nas5w\">Nick Scialli</a></li>\n<li><a href=\"https://ckeditor.com/blog/Aborting-a-signal-how-to-cancel-an-asynchronous-task-in-JavaScript/\">Aborting a signal: How to cancel an asynchronous task in JavaScript</a> Performing asynchronous tasks can be hard, fortunately, JavaScript offers a very handy piece of functionality for aborting an asynchronous activity. In this article, you can learn how to use it to create your own abortable function. By <a href=\"https://twitter.com/Comandeer2\">Tomasz Jakut</a></li>\n</ul>\n<h2>One Last Thing...</h2>\n<p>If you find any Node.js or JavaScript related content over the next week (or beyond!), never hesitate to reach out to us on Twitter at <a href=\"https://twitter.com/nodesource\">@NodeSource</a> to share and get it included in Need to Node - our DMs are open if you don’t want to share publicly!</p>"}},"categories":[{"name":"Node.js","slug":"node-js"},{"name":"Community","slug":"community"}]}},{"node":{"slug":"installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu","title":"Installing Node.js Tutorial: Using nvm","image":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/1p4eEtLFdGcVSekU5ZnCTi/7544a13de1bae997de913ce0609374eb/15-min.png","fileName":"15-min.png"}},"bodyContent":{"childMarkdownRemark":{"html":"<p>This article was first published in <a href=\"https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/\">NodeSource blog</a> on January 2017.</p>\n<p>As with any programming language, platform, or tool, the first step to using it is getting it installed. Many of them typically come with a speedy way to upgrade when a new version is available. </p>\n<p>By default, there's not a way to upgrade the version of Node.js you've got from within Node.js itself. That said, there's a fantastic tool for the community called <a href=\"https://github.com/creationix/nvm\">nvm</a> that allows you to manage the versions of Node.js that you've got installed locally. </p>\n<p>One awesome aspect of <code>nvm</code> is that it <em>manages</em> the versions of Node.js, it doesn't just upgrade them. This means you can have the latest version of Node.js, the latest versions of all the LTS release lines, and any number of other versions you want to use or test as well.</p>\n<p>In this quick tutorial, we'll take a look at how to install nvm, and then how to start using it as your version manager for Node.js. Once we've completed the tutorial, you'll be ready to take the next step with Node.js.</p>\n<p>This guide covers installing nvm on macOS and Linux - note that all versions of Node.js may not support <em>every</em> version of macOS or Linux.  </p>\n<h2>Step 0: The Quick Guide (TL;DR) to Get Node.js Installed using nvm</h2>\n<p>Here's the abbreviated guide, highlighting the major steps:</p>\n<ul>\n<li>\n<p>Download the nvm install script via cURL: </p>\n<ul>\n<li><code>curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash</code></li>\n</ul>\n</li>\n<li>Ensure that nvm was installed correctly with <code>nvm --version</code>, which should return the version of nvm installed.</li>\n<li>\n<p>Install the version of Node.js you want</p>\n<ul>\n<li>Install the latest version with <code>nvm install node</code></li>\n<li>Use the latest version with <code>nvm use node</code></li>\n<li>Install the latest LTS version with <code>nvm install --lts</code></li>\n<li>Use the latest LTS verison with <code>nvm use --lts</code></li>\n</ul>\n</li>\n</ul>\n<h2>Step 1 (Optional): Ensure your system has the appropriate C++ compiler</h2>\n<p>In some cases, like when installing Node.js releases from their source or installing versions of Node.js <em>before</em> <code>0.8.6</code> (when the project started shipping binaries), you'll need to ensure that your system has the appropriate C++ build tools.</p>\n<p>For LTS and modern releases, you <strong>will not need this step</strong>. That said, it's a <em>nice to have</em> to ensure that the majority of requirements are met in any scenario.</p>\n<p>On <strong>macOS</strong>, you've got two options for a C++ compiler: the full XCode application or the stand-alone Command Line Tools portion of Xcode. </p>\n<p>To get these on macOS, you can follow these steps:</p>\n<ul>\n<li>Open your terminal of choice</li>\n<li>\n<p>Run <code>xcode-select --install</code> as a command</p>\n<ul>\n<li>A popup will appear</li>\n<li>Select <code>Install</code></li>\n</ul>\n</li>\n<li>Allow the download to run to completion</li>\n<li>If the installation went uninterrupted, you should have the necessary tools to use nvm! </li>\n</ul>\n<p>On <strong>Linux</strong>, the C++ compiler will vary from distribution to distribution. For example, on Debian and Ubuntu, you'll need to install <code>build-tools</code> and <code>libssl-dev</code>, but this may be different on your given Linux distribution.</p>\n<p>To get <code>build-tools</code> and <code>libssl-dev</code> on Debuan and Ubuntu distributions, you can run these commands:</p>\n<pre><code class=\"language-plain\">sudo apt-get install build-essential # Install the build-essential package - let this run to completion\n\nsudo apt-get install libssl-dev # Install the libssl-dev package - also let this one run to completion\n</code></pre>\n<h2>Step 2: Download nvm with the install script</h2>\n<p>Once you've got the right C++ compiler for your system, now it's time to run the nvm install script. Here are the single-step install scripts for both macOS and Linux. You've got the option of cURL or Wget but both achieve the same result. </p>\n<p><em>Note:</em> If your Linux system doesn't have either cURL or Wget, you can run <code>sudo apt-get install curl</code> and use the cURL method.</p>\n<h3>Running the Install Script with cURL:</h3>\n<p>To install nvm with the cURL method, run the following command in your terminal:</p>\n<pre><code class=\"language-plain\">curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash\n</code></pre>\n<h3>Using the Install Script with Wget:</h3>\n<p>To install nvm with the Wget method, run the following command in your terminal:</p>\n<pre><code class=\"language-plain\">wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash\n</code></pre>\n<h2>Step 3: Verify that nvm was Properly installed</h2>\n<p>After running the install script from Step 2, nvm should have successfully installed. To ensure that nvm is up and running on your machine, you can test it with the following command:</p>\n<pre><code class=\"language-plain\">nvm --version\n</code></pre>\n<p>This command will return something like (though not necessarily exactly) the following: </p>\n<pre><code class=\"language-plain\">nvm --version # The command we ran - it checks the currently installed version of nvm\n0.33.0 # The current version of nvm - yours may differ!\n</code></pre>\n<h3>Missing the <code>nvm</code> command after running the install script?</h3>\n<p>If you're using macOS, you may be missing a <code>.bash_profile</code> file - to troubleshoot this, you can run <code>touch ~/.bash_profile</code> in your command line and re-run the installer script.</p>\n<p>If the problem persists after that, you can open the existing <code>.bash_profile</code> file (using your favorite text editor) and add the following line to it:</p>\n<pre><code class=\"language-plain\">source ~/.bashrc\n</code></pre>\n<p>If you're still having issues, you can take a peek at <a href=\"https://github.com/creationix/nvm/issues/576\">this issue</a> to find a discussion of the problem and a collection of possible resolutions.</p>\n<h2>Step 3: Using nvm to manage Node.js</h2>\n<p>Congratulations! You've now got <code>nvm</code> - a tool to <em>easily</em> allow you to manage and swap out the versions of Node.js you've got installed locally. Now, let's get you started with doing just that.</p>\n<h3>Install the latest Node.js version</h3>\n<p>To install the latest available version of Node.js, you can use the following command: </p>\n<pre><code class=\"language-plain\">nvm install node\n</code></pre>\n<p>Next, to <em>use</em> that version of Node.js in any new shell, you can simply run the <code>use</code> command:</p>\n<pre><code class=\"language-plain\">nvm use node\n</code></pre>\n<h3>Install the latest Node.js LTS version</h3>\n<p>To install the latest available <em>LTS</em> version of Node.js, you can run the following command: </p>\n<pre><code class=\"language-plain\">nvm install --lts\n</code></pre>\n<p>And to use that latatestTS version of Node.js in any new shell, you can simply run the <code>use</code> command:</p>\n<pre><code class=\"language-plain\">nvm use --lts\n</code></pre>\n<h2>Step 6: Go build applications, APIs, tools, and more with Node.js!</h2>\n<p>Now you've got a fantastic version manager for Node.js. It's time to start building!</p>\n<div class=\"blog-cta nsolid\">\n\tGet unparalleled visibility into application performance and system health.\n  <a class=\"button more large\" href=\"https://accounts.nodesource.com/sign-up-blogref/?utm_campaign=blogref&utm_source=blog&utm_content=blog-install-nvm\">Get started with N|Solid today</a>\n</div>\n<p>We've got some resources to get you kickstarted! Both the breadth and depth of the Node.js and the JavaScript ecosystems are quite large - in addition to the developer tools like <a href=\"https://nodesource.com/products/nsolid\">NodeSource N|Solid</a> and <a href=\"https://certified.nodesource.com/\">Certified Modules</a>, we've got a ton of tutorials, guides, and articles to help you get kick started with Node.js.</p>\n<p>If you're interested in keeping your code clean, maintainable, and collaborative, take a peek at our post on <a href=\"https://nodesource.com/blog/streamline-javascript-development-with-eslint\">using ESLint for linting your JavaScript applications</a>. Are you interested in building web applications with Node.js? One of the most challenging aspects of web apps is security - you can learn <a href=\"https://nodesource.com/blog/nine-security-tips-to-keep-express-from-getting-pwned\">security best practices for Express</a> to lock down your web apps, to prevent breaches and attacks. Or, maybe you want to deploy your Node.js apps with Docker? Then you should <em>definitely</em> read our article on <a href=\"https://nodesource.com/blog/8-protips-to-start-killing-it-when-dockerizing-node-js\">dockerizing your Node.js applications</a>.</p>\n<p>That said, if you want to keep in touch with the Node.js ecosystem, you should follow <a href=\"http://twitter.com/nodesource\">@NodeSource</a> on Twitter! We'll keep you updated with important news from the core Node.js project, fresh and useful Node.js tutorials, and more.</p>"}},"categories":[{"name":"How To","slug":"how-to"},{"name":"Node.js","slug":"node-js"},{"name":"Tutorials","slug":"tutorials"}]}}]},"contentfulHero":{"headLine":"Your latest Node.js content, news and updates in one place.","coverImage":{"file":{"url":"//images.ctfassets.net/xmu5vdhtphau/1ZgP9Kv0C8g1nuEX3zTs2a/f00ee931ce94307ccf8a62c17d3d67d2/social-bg-12__1_-min.png","fileName":"social-bg-12 (1)-min.png"}}}},"pageContext":{"categoryId":"4384d042-dd09-5c7b-967b-95eab1334a2c","category":"Node.js","limit":7,"skip":28,"numPages":5,"currentPage":5,"prevPath":"/category/node-js/page/4","nextPath":""}}}