Skip to content

Handy checklist for everywhere and anywhere you might need to set the version when upgrading to the latest Node.

Notifications You must be signed in to change notification settings

ThatGuySam/node-upgrade-checklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Node Upgrade Checklist

Handy checklist for everywhere and anywhere you might need to set the version when upgrading to the latest Node.

Fixes and Updates Welcome

Here's the comprehensive list with code examples, using Node version 22 as the example:

package.json Engines

// package.json
{
  "engines": {
    "node": "22.x"
  }
}
// https://docs.npmjs.com/cli/configuring-npm/package-json#engines

.nvmrc

// .nvmrc
22
// https://github.com/nvm-sh/nvm#nvmrc

.node-version

// .node-version
22
// https://github.com/shadowspawn/node-version-usage

.npmrc

// .npmrc
use-node-version=22
// https://docs.npmjs.com/cli/configuring-npm/npmrc

GitHub Actions

# .github/workflows/ci.yml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs#specifying-the-nodejs-versionz
          node-version: '22'

Dependency Managers

Reminder: Run npm install, pnpm install, etc... after updating the Node version to ensure dependencies are compatible.

Vercel Build and Serverless Config

⭐️ Defaults to Node Version in package.json/engines https://vercel.com/docs/project-configuration#project-configuration/build Available Node Versions

Netlify Build Config

⭐️ Setting .node-version or .nvmrc will override the version set in the Netlify UI.

# netlify.toml
[context.production]
  environment = { NODE_VERSION = "22.0.0" }
# https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript

Netlify TOML file reference

Netlify Runtime/Serverless Config

Unfortunately, as of June 2024 this can only be set in the Netlify UI.

AWS_LAMBDA_JS_RUNTIME=nodejs22.x

Netlify Runtime Node Version Support Lambda Versions

Update @types/node

npm install --save-dev @types/node@22
pnpm add --dev @types/node@22
# https://www.npmjs.com/package/@types/node

AWS Lambda

AWS Lambda uses the runtime parameter in the function configuration. Update it via the AWS Management Console or AWS CLI.

aws lambda update-function-configuration --function-name my-function --runtime nodejs22.x
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

Support Lambda Versions

Dockerfile

# Dockerfile
FROM node:22
# https://docs.docker.com/samples/node/

Heroku

To specify the version of Node.js to use on Heroku, use the engines section of the package.json. Drop the v to save only the version number. Heroku Node.js Version

CircleCI

# .circleci/config.yml
version: 2.1
jobs:
  build:
    docker:
      - image: circleci/node@5
    steps:
      - checkout
      - node/install:
          node-version: '22'

CircleCI Node.js Version

TravisCI

⭐️ If you don't specify a Node version, Travis CI will use the default to the version set in .nvmrc

# .travis.yml
language: node_js
node_js:
  - "22"

TravisCI Node.js Version

AWS Elastic Beanstalk(unverified)

Update the Node version in the platform configuration via the AWS Management Console or CLI.

aws elasticbeanstalk update-environment --environment-name my-env --option-settings Namespace=aws:elasticbeanstalk:container:nodejs,OptionName=NodeVersion,Value=22
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux.html#platforms-linux.nodejs

Google Cloud Functions(unverified)

Set engines.node in package.json as shown in item 1.

gcloud functions deploy my-function --runtime nodejs22
# https://cloud.google.com/functions/docs/concepts/nodejs-runtime

Summary Output

Ensure the CLI tool provides an output summary of all changes made, listing the files and their updated values. This helps in verifying the updates and troubleshooting any issues.

By following this comprehensive checklist and utilizing the code examples, you can ensure a smooth transition to a new Node version across various environments and configurations.

About

Handy checklist for everywhere and anywhere you might need to set the version when upgrading to the latest Node.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published