@@ -58,6 +58,8 @@ async function runReactNativeBundleCommand(
5858
5959 let usingExpo = false ;
6060 try {
61+
62+
6163 cliPath = require . resolve ( '@expo/cli' , {
6264 paths : [ process . cwd ( ) ] ,
6365 } ) ;
@@ -335,12 +337,19 @@ async function compileHermesByteCode(
335337
336338async function copyDebugidForSentry ( bundleName , outputFolder , sourcemapOutput ) {
337339 if ( sourcemapOutput ) {
338- const copyDebugidPath = require . resolve (
339- '@sentry/react-native/scripts/copy-debugid.js' ,
340- {
341- paths : [ process . cwd ( ) ] ,
342- } ,
343- ) ;
340+ let copyDebugidPath ;
341+ try {
342+ copyDebugidPath = require . resolve (
343+ '@sentry/react-native/scripts/copy-debugid.js' ,
344+ {
345+ paths : [ process . cwd ( ) ] ,
346+ } ,
347+ ) ;
348+ } catch ( error ) {
349+ console . error ( '无法找到 Sentry copy-debugid.js 脚本文件,请确保已正确安装 @sentry/react-native' ) ;
350+ return ;
351+ }
352+
344353 if ( ! fs . existsSync ( copyDebugidPath ) ) {
345354 return ;
346355 }
@@ -366,12 +375,20 @@ async function uploadSourcemapForSentry(
366375 sourcemapOutput ,
367376) {
368377 if ( sourcemapOutput ) {
369- const sentryCliPath = require . resolve ( '@sentry/cli/bin/sentry-cli' , {
370- paths : [ process . cwd ( ) ] ,
371- } ) ;
378+ let sentryCliPath ;
379+ try {
380+ sentryCliPath = require . resolve ( '@sentry/cli/bin/sentry-cli' , {
381+ paths : [ process . cwd ( ) ] ,
382+ } ) ;
383+ } catch ( error ) {
384+ console . error ( '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli' ) ;
385+ return ;
386+ }
387+
372388 if ( ! fs . existsSync ( sentryCliPath ) ) {
373389 return ;
374390 }
391+
375392 const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' , 'utf8' ) ) ;
376393 const version = packageJson . version ;
377394
0 commit comments