Skip to content

Conversation

@billxinli
Copy link

@billxinli billxinli commented Dec 17, 2025

Attempting to fix a bug where Socket CLI fails to detect npm version (socket optimize blocked) on windows.

Windows 11 + Powershell

Screenshot 2025-12-16 202932

Windows 11 + cmd

Screenshot 2025-12-16 202729

OSX

Screenshot 2025-12-17 at 1 43 20 AM

Note

Strengthens npm version detection on Windows to handle shims and JS entrypoints reliably.

  • Add preferWindowsCmdShim to select .cmd shims and use when resolving npm path
  • Use resolveBinPathSync in getAgentVersion to detect JS entrypoints (.js/.cjs/.mjs) and execute via node; otherwise spawn directly with shell: WIN32
  • Update getAgentExecPath for npm to prefer .cmd next to node.exe and handle shim replacement
  • Add test/package-environment.npm-version.test.mts with Vitest cases for JS entrypoint execution, fallback on resolution failure, and non-JS executables

Written by Cursor Bugbot for commit d245ebd. Configure here.

@billxinli billxinli marked this pull request as ready for review December 17, 2025 17:33
@jdalton
Copy link
Contributor

jdalton commented Dec 22, 2025

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


Comment @cursor review or bugbot run to trigger another review on this PR

@jdalton jdalton merged commit 1de47a9 into v1.x Dec 22, 2025
8 checks passed
@jdalton jdalton deleted the fix/windows branch December 22, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants