@@ -168,12 +168,20 @@ function detectPackageManager(cwd: string): PackageManager {
168168 if ( existsSync ( join ( cwd , "bun.lockb" ) ) && commandAvailable ( "bun" ) ) return "bun ";
169169 if ( existsSync ( join ( cwd , "pnpm-lock.yaml" ) ) && commandAvailable ( "pnpm" ) ) return "pnpm ";
170170 if ( existsSync ( join ( cwd , "yarn.lock" ) ) && commandAvailable ( "yarn" ) ) return "yarn ";
171+ if ( commandAvailable ( "npm" ) ) return "npm ";
171172 if ( commandAvailable ( "bun" ) ) return "bun ";
172173 if ( commandAvailable ( "pnpm" ) ) return "pnpm ";
173174 if ( commandAvailable ( "yarn" ) ) return "yarn ";
174175 return "npm ";
175176}
176177
178+ function detectPackageManagerForAuth ( cwd : string ) : PackageManager {
179+ // Always use npm for auth commands to ensure consistency
180+ if ( commandAvailable ( "npm" ) ) return "npm ";
181+ // Fallback to regular detection if npm is not available
182+ return detectPackageManager ( cwd ) ;
183+ }
184+
177185function runScript ( pm : PackageManager , script : string , cwd : string ) {
178186 const args = pm === "bun" ? [ "run" , script ] : pm === "yarn" ? [ script ] : [ "run" , script ] ;
179187 return bunSpawnSync ( pm , args , cwd ) ;
@@ -687,11 +695,13 @@ async function migrate(cliArgs?: CliArgs) {
687695 }
688696 }
689697
690- // Run auth:update
698+ // Run auth:update - use npm specifically for auth commands
691699 debugLog ( "Running auth:update script" ) ;
692700 const authSpinner = spinner ( ) ;
693701 authSpinner . start ( "Running auth:update..." ) ;
694- const authRes = runScript ( pm , "auth:update" , process . cwd ( ) ) ;
702+ const authPm = detectPackageManagerForAuth ( process . cwd ( ) ) ;
703+ debugLog ( `Using package manager for auth commands: ${ authPm } ` ) ;
704+ const authRes = runScript ( authPm , "auth:update" , process . cwd ( ) ) ;
695705 if ( authRes . code === 0 ) {
696706 authSpinner . stop ( pc . green ( "Auth schema updated." ) ) ;
697707 } else {
@@ -1804,7 +1814,9 @@ export const verification = {} as any;`;
18041814 const genAuth = spinner ( ) ;
18051815 genAuth . start ( "Generating auth schema..." ) ;
18061816 {
1807- const authRes = runScript ( pm , "auth:update" , targetDir ) ;
1817+ const authPm = detectPackageManagerForAuth ( targetDir ) ;
1818+ debugLog ( `Using package manager for auth commands: ${ authPm } ` ) ;
1819+ const authRes = runScript ( authPm , "auth:update" , targetDir ) ;
18081820 if ( authRes . code === 0 ) {
18091821 genAuth . stop ( pc . green ( "Auth schema updated." ) ) ;
18101822
0 commit comments