Skip to content

Cannot find module 'execa' when running npx react-native clean #2353

@DanNizy

Description

@DanNizy

Environment

  OS: macOS 14.4.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 937.20 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.03.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Description

When running npx react-native clean command and select metro watchman and npm to clean i get following error:

✔ Select all caches to clean › metro (Metro, haste-map caches), npm (`node_modules` folder in the current package, and optionally verify npm cache), watchman (Stop Watchman and delete its cache)
✔ Clean Metro cache
✔ Clean Haste cache
✔ Clean React Native cache
✔ Remove node_modules
✖ Stop Watchman » Error: Cannot find module 'execa'
Require stack:
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli-clean/build/clean.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli-clean/build/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/commands/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/bin.js
✖ Delete Watchman cache » Error: Cannot find module 'execa'
Require stack:
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli-clean/build/clean.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli-clean/build/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/commands/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/index.js
- /Users/danielnizynski/work/AwesomeProject/node_modules/@react-native-community/cli/build/bin.js

Reproducible Demo

  1. Create new project by running npx react-native@latest init
  2. Install dependencies (when these are not installed the error does not show up)
  3. run npx react-native clean and select metro, watchman and npm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions