Skip to content
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

Cannot find module react-refresh when running app for Chromecast. #1850

Open
GCheung55 opened this issue Feb 3, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@GCheung55
Copy link

GCheung55 commented Feb 3, 2025

Describe the bug
Cannot find module react-refresh when running app for Chromecast.

To Reproduce
Steps to reproduce the behavior:

  1. Run command npx rnv run -p chromecast
  2. See error

Expected behavior
Build for Chromecast to succeed.

Screenshots or copy&paste

error: ⨯ ○ run: Error: Cannot find module '/User/AwesomeUser/rnv-starter-prototype/node_modules/react-refresh/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:492:19)
    at Function._findPath (node:internal/modules/cjs/loader:790:18)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1230:27)
    at Function.resolve (node:internal/modules/helpers:146:19)
    at Object.<anonymous> (/Users/AwesomeUser/rnv-starter-prototype/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/utils/injectRefreshLoader.js:16:47)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)

Desktop (please complete the following information):

  • OS: OSX 14.5
  • Node Version 22.13.1
  • RNV Version 1.9 AND 1.10.0-rc.0

Additional context
The issue seems to be caused by injectRefreshLoader trying to look for the module from the project root, in this case rnv-starter-prototype.

react-refresh isn't defined as a dependency in the projects' package.json file, thus the error.

Current Workaround
Install react-refresh in the project as a dev dependency.

@GCheung55 GCheung55 added the bug Something isn't working label Feb 3, 2025
@GCheung55 GCheung55 changed the title Cannot find module react-refresh when running build for Chromecast. Cannot find module react-refresh when running app for Chromecast. Feb 3, 2025
@pauliusguzas
Copy link
Collaborator

@GCheung55 thats for reporting. Could you try node 18? If it still doesn't work, then please add precise steps how to reproduce on minimal project (blank rnv template).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants