Better specify expected Node.js version and update to v20.19.2 #399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The container image was pinned to Node.js 20.18.1, see
Dockerfile
:But attempting to use 20.18.1 to build Storybook, you encounter an error:
This is due to a recent change[1] that switched to using
import.meta.dirname
, a feature of Node.js ESM loading, instead of the legacy__dirname
. But automatic detection and loading a file as ESM is behind a feature flag until Node.js v20.19.0[2]. Thus breaking the Storybook build for the project's "official" Node 20.18.1 version and container workflow.So:
package.json
, which at least will display a warning to folks installing packages outside the container environment.package.json
specification to load the correct Node.js version in CIWhich should help keep all the different environments in sync. And the new Node.js module behavior is the default in later versions as well, so might as well lean into it.
[1] #392
[2] https://nodejs.org/en/blog/release/v20.19.0/#requireesm-is-now-enabled-by-default
Testing
navapbc/platform-test-nextjs#99