Earlier this year, I wrote a post about Why Developers Are Moving To Yarn. This struck a chord with many people who were frustrated with npm.

Yesterday, npm@5 (version 5.0.1) was released addressing many concerns that developers had. npm@5 is a fantastic update that should bring a lot of happiness to JavaScript developers.

Some of the key new features of npm@5 are:

  • a real lockfile (package-lock.json)
  • SHA512 hashes
  • cache infrastructure completely rewritten
  • dowload handling improved with concurrent downloads and better memory management (less OOMs, people!)

According to npm these changes (and more) have shown speed improvements of 20%-100%. You can read more about what’s new in npms release post.

Buried in the npm news is the latest major release of NodeJS (V8). Here are some of the highlights:

  • npm@5 is bundled (seriously, npm@5 is an awesome update)
  • V8 5.8 (V8 is the JavaScript engine made by Google that powers NodeJS)
  • new (experimental) native code API

More on the release on NodeJS’s official blog.

So, how do you get started using the latest and greatest on CircleCI? Thankfully, it’s very simple to do.

Using NodeJS v8 and npm v5 on CircleCI

Getting started with the new versions of NodeJS and npm is straightforward. npm@5 is bundled with NodeJS 8, so installing the new version of NodeJS is all that is needed.

On CircleCI 1.0:

machine:
  node:
    version: 8.0.0

dependencies:
  pre:
    - node --version
    - npm --version

On CircleCI 2.0:

version: 2
jobs:
  build:
    docker:
      - image: node:8.0
    steps:
      - run:
          name: "Checking Versions"
          command: |
            node --version
            npm --version

Caching / Pre-installing

On CircleCI 2.0, Docker is a first-class citizen. Speeding up a NodeJS-based project can be done with caching Docker images as well as our traditional caching.

With CircleCI 1.0, we have pre-built images that builds run on. While NodeJS 8.0.0 isn’t preinstalled on our Ubuntu 14.04 image yet, it should be soon.

Feel free to share your projects and feedback in CircleCI Discuss. We look forward to seeing what you build.