Skip to content

Commit

Permalink
feat: have a better warning when user don't have community cli
Browse files Browse the repository at this point in the history
  • Loading branch information
atlj committed Nov 15, 2024
1 parent 77351aa commit b50675e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/react-native-builder-bob/src/targets/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,24 @@ export default async function build({ root, report }: Options) {
`Errors found while generating codegen files:\n${e.stdout.toString()}`
);
} else if ('message' in e && typeof e.message === 'string') {
report.error(e.message);
if (
e.message.includes(
"Error: Cannot find module '@react-native-community/cli/package.json'"
)
) {
report.error(
"You don't have `@react-native-community/cli` in your root package's dev dependencies. Please install it and make sure it uses the same version as your application."
);
} else {
report.error(e.message);
}
} else {
throw e;
}
} else {
throw e;
}

throw new Error('Failed generate the codegen files.');
process.exit(1);
}
}

0 comments on commit b50675e

Please sign in to comment.