Files
vercel__next.js/examples/with-vitest/package.json
HAREESH BHITTAM 8dd5f48611 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: https://github.com/vercel/next.js/issues/82779

**Error Details:**
- Vite 7.1.3 requires `@types/node@"^20.19.0 || >=22.12.0"`
- Project was using `@types/node@20.10.4`
- 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: vite@7.1.3
npm error Found: @types/node@20.10.4
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
vitest@3.2.4
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
vite@7.1.3
npm error node_modules/vite
npm error peer vite@"^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" from
@vitejs/plugin-react@4.7.0
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 vitest@3.2.4
npm error   node_modules/vitest
npm error     dev vitest@"^3.2.4" from the root project
npm error
npm error Conflicting peer dependency: @types/node@24.3.0
npm error node_modules/@types/node
npm error peerOptional @types/node@"^20.19.0 || >=22.12.0" from
vite@7.1.3
npm error   node_modules/vite
npm error peer vite@"^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" from
@vitejs/plugin-react@4.7.0
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 vitest@3.2.4
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 <sephxd1234@gmail.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-20 14:57:22 +02:00

26 lines
548 B
JSON

{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "vitest"
},
"dependencies": {
"next": "latest",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"server-only": "^0.0.1"
},
"devDependencies": {
"@testing-library/react": "^16.3.0",
"@types/node": "^20.19.11",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^5.0.1",
"jsdom": "^26.1.0",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
}
}