Cannot find module `react-refresh` when running app for Chromecast.
Opened this issue · 1 comments
Describe the bug
Cannot find module react-refresh when running app for Chromecast.
To Reproduce
Steps to reproduce the behavior:
- Run command
npx rnv run -p chromecast - 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 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).