Skip to content

Commit e62123f

Browse files
chore(docs): Update "Set Node.js version" cloud (#37924)
Co-authored-by: Lennart <[email protected]>
1 parent 85d2aed commit e62123f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

docs/docs/how-to/cloud/set-node-version.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,35 @@ title: "Set a Node.js Version for Your Site"
33
description: "Learn how to set a Node version for your Gatsby Cloud site."
44
---
55

6-
## Introduction
6+
## Instructions
77

8-
You can specify a Node.js version for site in Gatsby Cloud in two different ways, by environment variable or `.nvmrc` file. If you don't set a Node version, Gatsby cloud will use Node 18 by default.
8+
You can specify a [Node.js](https://nodejs.org/en) version for your site in Gatsby Cloud in two different ways:
9+
10+
- Through an environment variable
11+
- With a `.nvmrc` file
12+
13+
If you don't explicitly set a Node.js version yourself, Gatsby Cloud will use its default version (current minimum supported Node.js version by Gatsby).
914

1015
### Environment variable
1116

1217
You can set your Node.js version using the `NODE_VERSION` environment variable inside Gatsby Cloud. Read more about [setting environment variables](/docs/reference/cloud/managing-environment-variables).
1318

1419
### Using nvm
1520

16-
You can include a `.nvmrc` file in your project repository, and Gatsby Cloud will read the Node version from that file.
21+
You can include a `.nvmrc` file in your project repository and Gatsby Cloud will read the Node.js version from that file.
1722

18-
Example format:
23+
An example file could look like this:
1924

2025
```javascript:title=.nvmrc
2126
v18.9.0
2227
```
28+
29+
You can write out the version you're currently using locally like this:
30+
31+
```shell
32+
node -v > .nvmrc
33+
```
34+
35+
## Troubleshooting
36+
37+
Sometimes Gatsby Cloud is not recognizing your new Node.js version after you set it. In those instances, try disabling your builds and preview (find them under "Site Settings" > "Builds") and then re-enabling them. This will reset your build container and make sure to use your new Node.js version.

0 commit comments

Comments
 (0)