Skip to content

Cannot find package 'jest-cli' when running yarn dlx react-native-harness@latest init #128

Description

@migueldaipre

Describe the bug

Description

Running yarn dlx react-native-harness@latest initcrashes with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jest-cli' imported from .../node_modules/@react-native-harness/cli/dist/index.js

Root Cause:

@react-native-harness/cli lists jest-clias a peerDependency ("jest-cli": "*") and a devDependency ("jest-cli": "^30.2.0"), but not as a regular dependency.

However, src/index.ts directly imports at runtime:

import { run, yargsOptions } from 'jest-cli';

Since jest-cli is neither a runtime dependency nor auto-installed by yarn dlx/npx, the import fails.

Expected behavior: yarn dlx react-native-harness@latest init should work without requiring the user to manually install jest-cli first.

I can provide a repro if it's really necessary.

System Info

- react-native-harness: 1.2.0
- @react-native-harness/cli: 1.2.0
- Node.js: v20.19.4
- Yarn: 4.13.0
- OS: macOS

React Native Harness Version

1.2.0

Reproduction

https://github.com/migueldaipre/react-native-harness

Steps to reproduce

Run yarn dlx react-native-harness@latest init on an empty rn project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions