Skip to content

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

@GCheung55

Description

@GCheung55

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions