Skip to content

chore(deps): pin engines.node >=22.12.0 to fix local vitest on Windows#99

Open
Nic-dorman wants to merge 1 commit into
mainfrom
fix/vitest-windows-node-version
Open

chore(deps): pin engines.node >=22.12.0 to fix local vitest on Windows#99
Nic-dorman wants to merge 1 commit into
mainfrom
fix/vitest-windows-node-version

Conversation

@Nic-dorman
Copy link
Copy Markdown
Contributor

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

  • `package.json` — `engines.node: ">=22.12.0"`. Also bumps `@vue/test-utils` floor from `^2.4.6` to `^2.4.9` (matches what npm resolves to today, drops a stale floor).
  • `.nvmrc` — `22` so devs using nvm pick the right Node automatically on clone.
  • `package-lock.json` — engines field + a stale `0.6.7 → 0.7.0` version-bump catchup that the release commits missed.

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

  • CI on Node 22 LTS continues green (vitest + nuxi typecheck)
  • Locally on Node 22.12+ after this lands: `npm run test:run -- tests/stores/files.test.ts` should pass (currently the new files store test from PR fix(files): never overwrite upload_history.json on load failure #95 hits the same require(esm) error)
  • No production behavior change — only dev tooling

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant