Node.js Articles

Convert a buffer to a string in Node.js

Buffers are powerful stuff. They make it easy to work with raw binary data, and streaming data can leverage them. Many third-party Node.js dependencies leverage buffers in one way or another, especially libraries dealing with data transport. So what the heck are we supposed to do with a Buffer when […]

How to install Node.js 19 on Ubuntu 20.04 LTS

Periodically, I check my site analytics to see which posts are getting the most traffic. It never ceases to amaze me at how many posts documenting older versions of Ubuntu, as far back as 16.04 LTS, still receive regular traffic. While they may not be evergreen forever, there’s something to […]

Using paths to create hierarchies in Parameter Store

Parameter Store only supports a limited number of character for the parameter name. As per the error message you’re presented with, Only a mix of letters, numbers and the following 3 symbols .-_ are allowed. What that error fails to mention is that you can actually use a fourth symbol, […]

Getting String and SecureString Parameter Store parameters with Node.js

Parameter Store has slowly become one of my favorite things about AWS. It makes it easy to share things between ECS tasks and services, and Lambdas. The parameters can be references inside of a CodeBuild buildspec file, and it’s all language agnostic, which is handy if you are running different […]

husky: command not found with npm install --production

Recently, while attempting to build a Docker container, I ran into a bit of a dilemma. Upon running npm install --production I was greeted with this less than ideal error message: > @company/[email protected] prepare > husky install sh: husky: command not found Well of course husky isn’t installed, as it’s […]

Decrypting SecureString Parameter Store parameters with Node.js

Parameter Store, part of AWS Systems Manager gives you a quick and easy way to store parameters that you’d like to use in your applications. By selecting the SecureString type, you get the added bonus of encryption for you most secret parameters. By default, when you fetch a SecureString type […]

How to convert JSON to CSV in JavaScript

Last week we discussed converting CSV to JSON in JavaScript. This week, we’re going to talk about going in the opposite direction, converting JSON back to CSV. Similar to last week, we’re going to use the immensely popular papaparse library. As it turns out, even though it’s touted as the […]

How to convert CSV to JSON in JavaScript

Parsing CSV data isn’t as easy as splitting the string up into individual lines, then splitting it by the delimited (in this case commas). Some of the values may have quotes around them, sometimes the values themselves have line breaks. Then there’s the potential that the data itself is malformed. […]

How to install Node.js 18 on Ubuntu 20.04 LTS

It’s that time of year again, for not just a new version of Node.js, but for a new version of Ubuntu as well! Sadly though, my preferred method of installing Node.js on Ubuntu isn’t quite ready for Ubuntu 22.04 LTS. That’s okay though, I don’t like to upgrade to a […]

Downloading files in Node.js with Axios

I’ved used Axios a ton, but I’ve only ever used it to make AJAX requests. In fact, I don’t ever remember a time when I’ve needed to download a file and save it to disk in Node.js. That changed recently with a new side gig I’ve been helping out with. […]

How to install Node.js 17.x on Ubuntu LTS

As All Hallows Eve approaches, we are greeted with a brand new “current” release of Node.js, version 17. For those out there are aren’t aware of how Node.js releases work, even numbered releases eventually get promoted to long-term support (LTS) status, while odd numbered releases, will not. They are effectively […]

Best way to pin TypeScript as a dependency

While I’m a pretty big fan of TypeScript, there’s some stuff that drives me up a wall. One of those things recently came to light during the release of TypeScript 4.4 on a Friday afternoon. So it was nearing both end of day and end of week, and we were […]

Remove unnecessary files in node_modules

As the meme goes, the object with the largest mass in our universe is the node_modules directory. Generally speaking, storage is cheap, and while an unkept set of dependencies can be quite messy (and often times a security hazard), the size of your node_modules directory tends to not be of […]

How to install Node.js 16 on Ubuntu 20.04 LTS

Ubuntu tends to drop a new version of their April release shortly after a new version of Node.js drops. Every other year, this Ubuntu release is a long-term support release, which has a longer shelf life in terms of support and maintenance compared to their interim releases. True to form […]

Find unused npm dependencies

As much as I love to sling code, I love that we live in a world where you can stand on the shoulders of giants and easily leverage other people’s hard work by way of Open Source libraries. Simply referred to as “dependencies”, these little code gems can save a […]

Uninstalling dev dependencies with npm

While looking into some deployment issues recently, I ran into some logic that was in dire need of being refactored. The logic in the build process was installing all dependencies with npm, then removing the node_modules directory, just to install the production dependencies again. Yes, you read that right, the […]

Recursively create directories with Node.js

Recently, while working on a new project, I needed to create a series of nested directories. From the command-line, it’s easy enough, just pass -p to mkdir and it will create all of the parent directories automatically. With modern versions of Node.js, specifically 10 and above, you can achieve the […]

Displaying an entire object with Node.js

For the most part, I do the majority of my debugging with Node.js / JavaScript’s console.log(). It’s quick and dirty but it gets me what I’m looking for. The exception being when I am working with larger objects, specifically any object that is nested three or more levels deep. Here’s […]

How to install Node.js v15.x on Ubuntu

New Ubuntu and Node.js versions released recently. While neither is a long-term service (LTS) release, they still represent the best that both parties have to offer. Even though Ubuntu 20.10 is here, it’s still shipping with an older version of Node.js, v12.x to be exact. If you’re like me, you […]

Allow dots in paths with webpack-dev-server

Generally speaking, I don’t use dots (periods, full stops, whatever else they may be called) in the URI for a website. That was, until I made the . an allowable character for user names on one of my projects. Allowing the character was a big deal at all with Express.js […]

How to install Node.js v14.x on Debian and Ubuntu

Big week for both the Node.js universe and the Ubuntu universe. Node.js version 14.x dropped on Tuesday the 21st with Ubuntu 20.04 LTS coming in hot on Thursday the 23rd. Both releases are important because they are both long term support releases. Node.js v14.x isn’t currently LTS, but it will […]

How to install Node.js v14.x on Ubuntu 20.04 LTS

The latest and greatest long term service release of Ubuntu is here and there’s no reason that you shouldn’t get to enjoy the latest and greatest (soon to be) long term service release of Node.js as well. Follow these quick and easy steps to install Node.js v14.x on your shiney […]

How to install Node.js v14.x on Ubuntu 19.10

Even though Ubuntu 20.04 LTS is right around the corner, that doesn’t mean you’re going to jump right on it. If you’re waiting for that first point release but still want to harness the power of the latest and greatest version of Node.js, you can follow these quick and easy […]

How to install Node.js v14.x on Ubuntu 19.04

Just because you’re a couple of versions behind the current Ubuntu release doesn’t mean you shouldn’t get to take advantage of the latest version of Node.js. Follow these quick and easy steps to install Node.js v14.x on your Ubuntu 19.04 system.<h2 id="getting-started">Getting started</h2> Before we can install Node.js we need […]

How to install Node.js v14.x on Ubuntu 18.10

You know your Ubuntu system is a bit behind, but who has time for system upgrades? Any why should that stop you from being able to use the latest version of Node.js? Turns out, it doesn’t, and by following these quick and easy steps you can run Node.js v14.x on […]