chore(deps): pin engines.node >=22.12.0 to fix local vitest on Windows#99
Open
Nic-dorman wants to merge 1 commit into
Open
chore(deps): pin engines.node >=22.12.0 to fix local vitest on Windows#99Nic-dorman wants to merge 1 commit into
Nic-dorman wants to merge 1 commit into
Conversation
Vitest fails locally on Windows + Node 20.18 with:
Error: require() of ES Module .../node_modules/vue/index.mjs not supported.
Instead change the require of .../node_modules/vue/index.mjs to a dynamic
import() which is available in all CommonJS modules.
The Nuxt vitest environment loads @vue/test-utils via require(), which in
turn does `require('vue')`. Vue 3.5 is pure ESM, so Node 20.x rejects the
require call. Node 22.12+ enabled require(esm) by default, fixing this
class of error without any code change on our side.
CI already uses lts/* (Node 22 LTS as of Nov 2024), so this only
formalises the floor. Existing devs on Node 20 get an EBADENGINE warning
(not an error) on `npm install` and a clear signal to upgrade.
Three changes:
1. package.json — add `engines.node: ">=22.12.0"`. Also bumps the
@vue/test-utils floor from ^2.4.6 to ^2.4.9, matching what
npm resolves to today.
2. .nvmrc — `22`, so devs using nvm pick the right Node automatically.
3. package-lock.json — picks up the engines field plus a stale 0.6.7
version-bump catchup that the release commits missed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Vitest fails locally on Windows + Node 20.18 with the `require() of ES Module not supported` error from `@vue/test-utils` trying to `require('vue')` (vue 3.5 is pure ESM). Node 22.12+ enabled `require(esm)` by default, fixing this whole class of error.
CI already uses `lts/*` (Node 22 LTS as of November 2024) so this PR just formalises the floor — no CI behavior change.
Changes
Impact on existing devs
Anyone on Node 20.x sees `npm install` print:
```
npm warn EBADENGINE required: { node: '^20.19.0 || >=22.12.0' },
npm warn EBADENGINE current: { node: 'v20.18.0', npm: '10.8.2' }
```
It's a warning, not an error — the install still completes. Provides a clear signal to upgrade.
Test plan
🤖 Generated with Claude Code