@@ -6,6 +6,7 @@ import semver from 'semver'
66import which from 'which'
77
88import { parse as parseBunLockb } from '@socketregistry/hyrious__bun.lockb/index.cjs'
9+ import { debugLog } from '@socketsecurity/registry/lib/debug'
910import { Logger } from '@socketsecurity/registry/lib/logger'
1011import { readPackageJson } from '@socketsecurity/registry/lib/packages'
1112import { naturalCompare } from '@socketsecurity/registry/lib/sorts'
@@ -50,6 +51,10 @@ const binByAgent = new Map<Agent, string>([
5051
5152async function getAgentExecPath ( agent : Agent ) : Promise < string > {
5253 const binName = binByAgent . get ( agent ) !
54+ if ( binName === NPM ) {
55+ // Lazily access constants.npmExecPath.
56+ return constants . npmExecPath
57+ }
5358 return ( await which ( binName , { nothrow : true } ) ) ?? binName
5459}
5560
@@ -67,8 +72,8 @@ async function getAgentVersion(
6772 // All package managers support the "--version" flag.
6873 ( await spawn ( agentExecPath , [ '--version' ] , { cwd } ) ) . stdout
6974 ) ?? undefined
70- } catch ( e ) {
71- console . log ( e )
75+ } catch ( e ) {
76+ debugLog ( 'getAgentVersion error:\n' , e )
7277 }
7378 return result
7479}
@@ -399,7 +404,6 @@ export async function detectAndValidatePackageEnvironment(
399404 const agentVersion = details . agentVersion ?? 'unknown'
400405 if ( ! details . agentSupported ) {
401406 const minVersion = constants . minimumVersionByAgent . get ( agent ) !
402- console . dir ( { details } , { depth : 999 } )
403407 logger ?. fail (
404408 cmdPrefixMessage (
405409 cmdName ,
0 commit comments