Skip to content

Commit 8dd5f48

Browse files
fix: update @types/node to resolve Vite 7.x peer dependency conflict (#82794)
## 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 - [x] `npm install` runs without errors - [x] `npm test` passes all existing tests - [x] 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 --------- Co-authored-by: Joseph <[email protected]> Co-authored-by: Joseph <[email protected]>
1 parent df5bc54 commit 8dd5f48

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

examples/with-vitest/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
},
99
"dependencies": {
1010
"next": "latest",
11-
"react": "^18.2.0",
12-
"react-dom": "^18.2.0",
11+
"react": "^19.1.1",
12+
"react-dom": "^19.1.1",
1313
"server-only": "^0.0.1"
1414
},
1515
"devDependencies": {
16-
"@testing-library/react": "14.1.2",
17-
"@types/node": "20.10.4",
18-
"@types/react": "18.2.45",
19-
"@vitejs/plugin-react": "^4.2.1",
20-
"jsdom": "^23.0.1",
21-
"typescript": "5.3.3",
22-
"vitest": "1.0.4"
16+
"@testing-library/react": "^16.3.0",
17+
"@types/node": "^20.19.11",
18+
"@types/react": "^19.1.10",
19+
"@types/react-dom": "^19.1.7",
20+
"@vitejs/plugin-react": "^5.0.1",
21+
"jsdom": "^26.1.0",
22+
"typescript": "^5.9.2",
23+
"vitest": "^3.2.4"
2324
}
2425
}

0 commit comments

Comments
 (0)