Skip to content

Commit

Permalink
try/catch require package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Sep 21, 2023
1 parent 86a547e commit 5f386b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/cli-platform-ios/src/tools/pods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ interface NativeDependencies {
}

export function getPackageJson(root: string) {
return require(path.join(root, 'package.json'));
try {
return require(path.join(root, 'package.json'));
} catch {
throw new CLIError(
'No package.json found. Please make sure the file exists in the current folder.',
);
}
}

export function getIosDependencies(dependencies: NativeDependencies) {
Expand Down

0 comments on commit 5f386b4

Please sign in to comment.