FUNDAMENTAL

How to change Gatsby Cloud node version?

Now a days, there are many static site generator out there in the market. One of them is GatsbyJs. It is is based upon React.

GatsbyJs provides Gatsby Cloud apart from open source framework GatsbyJs

If you want to deploy your GatsbyJs website on Gatsby Cloud, you can do so for FREE. Checkout their pricing modal here -> https://www.gatsbyjs.com/pricing/

When you deploy your site on Gatsby Cloud, if you are using npm version less than 7, then the default node version Gatsby uses is v14. If you are using npm version 7 or more, then the default Gatsby node engine version is v16.

If you want, you can define your own node engine version for Gatsby Cloud.

Change node version using .nvmrc

You can change node version for Gatsby Cloud using .nvmrc file.

Here are steps:

  1. Create .nvmrc file

First of all, create a file named .nvmrc at root of your project. If you are using terminal, then use this command to create an empty file:

touch .nvmrc
  1. Add the version in the body

Now, Add the node version in the body of the file like below. Here I have used node version 18.

v18.0.0

That's all.

Now deploy these changes to Gatsby Cloud.

In the build log, you will see that Gatsby Cloud is now using node v18.0.0 for building purposes.