renative icon indicating copy to clipboard operation
renative copied to clipboard

Cannot find module '<project>/node_modules/react-native/local-cli/cli.js' with react-native@>0.75

Open GCheung55 opened this issue 11 months ago • 1 comments

Describe the bug Starting with [email protected], react-native/local-cli/cli.js has been deleted. This caused android builds to fail.

To Reproduce Steps to reproduce the behavior:

  1. Run command to install [email protected], which is the latest at the time of this bug report. npm install react-native@~0.77.
  2. Run command npx rnv run -p android

Expected behavior Build to succeed.

Screenshots or copy&paste

Error: Cannot find module '/<path-to-project>/node_modules/react-native/local-cli/cli.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1244:15)
    at Function._load (node:internal/modules/cjs/loader:1070:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
    at node:internal/main/run_main_module:36:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Desktop (please complete the following information):

  • OS: OSX 14.5
  • Node Version 22.13.1
  • RNV Version 1.10.0-rc.0
  • Java Version 23.0.2
  • Gradle Version 8.12.1

Additional context The fix may be to update sdk-react-native to rely on react-native-community/cli, like react-native/local-cli/cli.js is basically doing.

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 */

'use strict';

var cli = require('@react-native-community/cli');

if (require.main === module) {
  cli.run();
}

module.exports = cli;

GCheung55 avatar Feb 05 '25 23:02 GCheung55

@GCheung55 thanks for the issue, you can look from PR's we are in progress of updating react native, so it should be resolved pretty soon

pauliusguzas avatar Feb 07 '25 13:02 pauliusguzas