'Can't compile Gatsby.js project after node.js update

I'm trying to run in VSCode terminal gatsby develop and get

ERROR #11903 COMPILATION

There was an unhandled error during compilation for . Please run the command with the --verbose flag again.

Error: Error opening directory not finished compile gatsby files - 0.834s

Node version 17.7.1

I would be very grateful for help.



Solution 1:[1]

I've got a few older Gatsby projects that run on previous versions of node (12 and 14). Rather than upgrade locally I use the older versions of node for those project.

I use the following package to keep it easy: https://www.npmjs.com/package/n

Enter n in your CL and select the version of node you want to use for that project. When you are done and working on current projects switch node back to 17+ by typing n and reloading the current version.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 3200 Pro