Skip to content

fix: update @types/node to resolve Vite 7.x peer dependency conflict#82794

Merged
icyJoseph merged 6 commits intovercel:canaryfrom
Hareesh108:examples/upgrade-with-vitest
Aug 20, 2025
Merged

fix: update @types/node to resolve Vite 7.x peer dependency conflict#82794
icyJoseph merged 6 commits intovercel:canaryfrom
Hareesh108:examples/upgrade-with-vitest

Conversation

@Hareesh108
Copy link
Copy Markdown
Contributor

@Hareesh108 Hareesh108 commented Aug 19, 2025

Problem

The project was experiencing npm dependency resolution conflicts when running npm install, caused by incompatible @types/node versions between Vite 7.1.3 and the existing project dependencies.

Fixes: #82779

Error Details:

  • Vite 7.1.3 requires @types/node@"^20.19.0 || >=22.12.0"
  • Project was using @types/[email protected]
  • This created a peer dependency conflict, preventing clean installs

Solution

Updated @types/node from 20.10.4 to a compatible version that satisfies Vite 7.x requirements while maintaining compatibility with Vitest 3.2.4.

Changes Made

  • Updated @types/node version in package.json
  • Verified compatibility with all existing dependencies
  • Confirmed tests still pass with deprecation warnings (React.act import warnings - separate issue)

Testing

  • npm install runs without errors
  • npm test passes all existing tests
  • No breaking changes to existing functionality

Additional Notes

This fix resolves the immediate dependency conflict. The React.act deprecation warnings in tests are a separate issue and should be addressed in a future PR by updating test imports from react-dom/test-utils to react.

Details Issue:
1]
npm test

test
vitest

The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

DEV v1.0.4 /home/hareesh/learn-frontend/front-open-source/next.js/examples/with-vitest

stderr | app/blog/[slug]/page.test.tsx > App Router: Works with dynamic route segments
Warning: ReactDOMTestUtils.act is deprecated in favor of React.act. Import act from react instead of react-dom/test-utils. See https://react.dev/warnings/react-dom-test-utils for more info.

stderr | app/page.test.tsx > App Router: Works with Server Components
Warning: ReactDOMTestUtils.act is deprecated in favor of React.act. Import act from react instead of react-dom/test-utils. See https://react.dev/warnings/react-dom-test-utils for more info.

stderr | app/counter.test.tsx > App Router: Works with Client Components
Warning: ReactDOMTestUtils.act is deprecated in favor of React.act. Import act from react instead of react-dom/test-utils. See https://react.dev/warnings/react-dom-test-utils for more info.

stderr | tests/Home.test.tsx > Pages Router
Warning: ReactDOMTestUtils.act is deprecated in favor of React.act. Import act from react instead of react-dom/test-utils. See https://react.dev/warnings/react-dom-test-utils for more info.

2]
npm install

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: @types/[email protected]
npm error node_modules/@types/node
npm error dev @types/node@"20.10.4" from the root project
npm error peerOptional @types/node@"^18.0.0 || ^20.0.0 || >=22.0.0" from [email protected]
npm error node_modules/vitest
npm error dev vitest@"^3.2.4" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional @types/node@"^20.19.0 || >=22.12.0" from [email protected]
npm error node_modules/vite
npm error peer vite@"^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" from @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-react
npm error dev @vitejs/plugin-react@"^4.2.1" from the root project
npm error vite@"^5.0.0 || ^6.0.0 || ^7.0.0-0" from [email protected]
npm error node_modules/vitest
npm error dev vitest@"^3.2.4" from the root project
npm error
npm error Conflicting peer dependency: @types/[email protected]
npm error node_modules/@types/node
npm error peerOptional @types/node@"^20.19.0 || >=22.12.0" from [email protected]
npm error node_modules/vite
npm error peer vite@"^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" from @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-react
npm error dev @vitejs/plugin-react@"^4.2.1" from the root project
npm error vite@"^5.0.0 || ^6.0.0 || ^7.0.0-0" from [email protected]
npm error node_modules/vitest
npm error dev vitest@"^3.2.4" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/hareesh/.npm/_logs/2025-08-19T17_17_17_782Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/hareesh/.npm/_logs/2025-08-19T17_17_17_782Z-debug-0.log

@ijjk ijjk added the examples Issue was opened via the examples template. label Aug 19, 2025
@ijjk
Copy link
Copy Markdown
Member

ijjk commented Aug 19, 2025

Allow CI Workflow Run

  • approve CI run for commit: 533088f

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Comment thread examples/with-vitest/package.json
Comment thread examples/with-vitest/package.json
@icyJoseph icyJoseph merged commit 8dd5f48 into vercel:canary Aug 20, 2025
63 checks passed
@github-actions github-actions bot added the locked label Sep 4, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

examples Issue was opened via the examples template. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: with-vitest project in not upto date.

3 participants