Blog articles

5 questions Node.js developers want answered

By Ryan Lewis

It wouldn’t be a stretch to call 2019 the year of Node.js. With JavaScript being the most popular language and Node.js being the most used and loved framework, there’s no better time to break into the Node.js ecosystem. In our recent Node.js webinar, Pluralsight author and Node.js contributor Ryan Lewis shared an update with the newest features in Node.js and news from the community. Developers still had Node questions, so Ryan took some time to answer them below.

How difficult is the migration from Node.js version 8.x to 10.x?

Node.js version 8 ends its Active LTS status as of January 2019. This means that in January, version 8 then enters a 12-month period of only bug fixes and security patches before sunsetting at end of 2019. As such, developers should be actively moving their apps to version 10.

Skipping two versions of any software is always a little scary. Luckily the Node.js API is relatively stable and, depending on the complexity of your application, the migration should be fairly painless.

In my experience, you’ll run into two main challenges as you’re upgrading:

First, the Buffer constructor has been deprecated. Buffer usage isn’t uncommon, so you may find some places that you’ll need to update how you’re creating new Buffers. Check out the documentation for Node.js 10.x.

Second, dependencies you use in your Node.js projects will likely be doing more low-level stuff than your application code, so you will probably have to go through a dependency upgrade sprint to get everything to 10.x compatible versions. This will take the most time during your migration. Dependencies can be hairy or easy; on the bright side, 10.x has been released for almost a year at this point, so all of your dependencies should be compatible. If a dependency hasn’t been upgraded to work with 10.x, then I’d suggest dropping it since development on that dependency looks to have stopped.

Which IDE (Integrated Development Environment) is best for Node.js development?

Most software engineers coming from ecosystems like Java or .NET are very familiar with the necessity of IDEs for developing applications. JavaScript and Node.js development is different in that you don’t need an IDE. Applications can be built using simple text editors, and the .js files that you create, edit and save are accessed by the browser or the Node.js binary executable—no compilation required.

Even though you don’t need anything more than a text editor, it’s really nice to have something that assists you with development. I wouldn’t call these IDEs, as they’re more like beefed-up code editors.

The best option today for Node.js dev is Visual Studio Code. Not to be confused with Visual Studio (the IDE for .NET), Visual Studio Code is an open source code editor created primarily for JavaScript development. One of its unique features is the ability to debug Node.js applications as they run, something that no other editor can do (that I’ve found). There are a ton of plugins available to give you linting, code completion, dependency linking and all sorts of other goodies.

Atom is a close second. Like Visual Studio Code, it’s a free code editor with a healthy plugin ecosystem built on the Electron framework. Atom is developed by GitHub and is also open source and free. I used to use Atom a lot, but in my experience, I’ve found Visual Studio Code to be a little snappier and use less memory than Atom. It will be interesting to see the future of both projects since Microsoft acquired GitHub last year and now essentially owns both competing products.

Finally, many engineers at my company use Vim these days and love it. If you are a Vim user, then I’d suggest investigating what kind of plugins are available to make JavaScript and Node.js development easy. If you aren’t a Vim user, I’d suggest looking at the suggestions above—Vim is hard to learn. In fact, one of my goals this year is to learn and start using Vim.

Is there a better installer for Node.js than Homebrew?

Homebrew (a package installer application for MacOS) is a great way to install Node.js; I used it for many years. When I started doing more Node.js development at work, however, it was no longer sufficiently robust. The key thing I needed was to be able to switch versions easily, since I had to support applications that were running on a variety of Node.js versions.

I started using a Node.js version managing application called nvm. An acronym for “Node Version Manager”, nvm allows you to install many different versions of Node.js, npm and global dependencies and switch between them easily. Since new minor versions of Node.js are released at least monthly, it’s nice to be able to upgrade quickly and easily with nvm.

Windows users aren’t out of luck here. There is a similar Node.js version manager for Windows called nvm-windows. I haven’t used it yet, but it seems to promise the same experience and functionality as nvm.

Do you need to be a seasoned full stack developer to work with Node.js?

The quick answer is no, you don’t. 

The Node.js ecosystem can initially seem a little obtuse from the outside. Many front end developers get a soft welcome to Node.js when it’s needed for dependencies and frameworks, but developers just starting out might not know where to start.

Luckily, the community around Node.js is extremely active and motivated. There are a lot of resources out there for developers to get started with Node.js easily no matter their experience level.

If you’re coming at Node.js with deep experience in an existing development language, I recommend using what you’ve learned as you get into Node.js. I have a pretty strong background in Java, and I’ve found that approaching Node.js applications with the best practices from learning Java development have actually improved my applications. 

Pluralsight has a lot of great Node.js courses for developers. There’s also a free command line tutorial application for learning all sorts of things in Node.js called NodeSchool.

What are the new features in Node.js version 11?

Node.js version 11 was released in October 2018 and represents the newest non-LTS major version of Node.js. These non-LTS versions won’t be supported like LTS versions, but they give the Node.js development community an opportunity to work on new features and performance improvements. (I like to add the caveat to discussions of non-LTS Node.js versions that they will only be supported for around six months, and therefore shouldn’t be used for production systems.)

Node.js version 11 doesn’t bring a lot of new API changes—mostly bug fixes and code improvements. (The full changelog can be found here, but be warned it’s pretty dense.) However, there are two non-Node.js code additions to Node.js in version 11 that I think are particularly cool:

New V8 version

Node.js 11 ships with version 7 of the V8 engine. This brings a lot of significant performance improvements. The biggest new feature here is live code-coverage. This means that by using a flag, Node.js can output what lines were executed as your application runs (using this new V8 feature). This removes the need to use a coverage reporter that transpiles your code beforehand and improves testing speed. This feature is still really new, but you can try it out using the c8 package.

New npm version

Node.js 11 ships with version 6.x of npm. This new version of npm has some really cool new additions, such as the npm audit feature. By running ‘npm audit’ you will be able to view which dependencies have reported security issues and can upgrade them easily. This new version of npm is also way faster than the previous one. Adding to the speed feature is another new npm command: ‘npm ci’. This is a new command to install dependencies for your continuous integration servers. It’ll install everything for your project significantly faster than a normal ‘npm install.’

Download the new version of Node.js here and give it a shot. And learn more about the latest developments with the full webinar on Node.js trends

About the author

Ryan Lewis is a Software Engineer who specializes in ambitious single page web applications. He started building websites over 15 years ago to promote his bands and record label. After traveling around the world playing music, he brought his talents to the Pacific Northwest, where he utilizes open-source technologies, such as Backbone, Ember, and Node.js, to build business intelligence and customer facing applications for companies such as Expedia and T-Mobile.