codesandbox / codesandbox/codesandbox-client

ModuleNotFoundError: Could not find module in path: '<path/file>' relative to '<path/file>'

Open
#6,172 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

Description of the problem

import { renderHook, act } from "@testing-library/react-hooks";

causes error:

ModuleNotFoundError: Could not find module in path: '@testing-library/react-hooks/lib/dom/pure' relative to '/node_modules/@testing-library/react-hooks/lib/pure.js'

How has this issue affected you? What are you trying to accomplish?

Prevents application from loading in codesandbox so that React Test Library support cannot help with an issue I have with testing.

Link to sandbox: link (optional)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the import failure in the linked CodeSandbox, starting with tests/hooks/useCounter.test.ts and the @testing-library/react-hooks import shown in the report. Trace resolution of @testing-library/react-hooks/lib/dom/pure relative to lib/pure.js; done means the sandbox loads and the import works without ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.