Skip to content

Cannot find package 'vitest' #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbwestphal opened this issue Feb 6, 2025 · 1 comment
Open

Cannot find package 'vitest' #662

mbwestphal opened this issue Feb 6, 2025 · 1 comment

Comments

@mbwestphal
Copy link

  • @testing-library/jest-dom version: 6.6.3
  • node version: v22.13.1
  • jest (or vitest) version: 3.0.5
  • npm (or yarn) version: [email protected]

Relevant code or config:

; .npmrc
hoist=false

What you did:

Tried running tests.

What happened:

Error: Cannot find package 'vitest' imported from /path/to/project/ui/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/jest-dom/dist/vitest.mjs

Suggested solution:

vitest is declared in the devDependencies of @testing-library/jest-dom but it must be declared in the dependencies or peerDependencies because @testing-library/jest-dom/dist/vitest.mjs is importing vitests expect at test run time.

@dnafication
Copy link

I'm getting the same error, someone should patch it up. I ended up downgrading to 6.5

"@testing-library/jest-dom": "6.5"

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 a pull request may close this issue.

2 participants