npm/git

[BUG] Cannot install git package without HEAD ref

juliano-souza000 opened this issue · 0 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npm install fails to clone branch, commit hash or tag when the repo does not have a HEAD reference.

Error Message:
`npm ERR! Cannot read properties of undefined (reading 'sha')

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache_logs\2023-01-26T12_33_01_788Z-debug-0.log`

Expected Behavior

It should still be able to clone the specified reference.

Steps To Reproduce

  1. Run npm install ssh+git://git@private/private_repo#reference
  2. Wait for the error to show up.
    `npm ERR! Cannot read properties of undefined (reading 'sha')

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache_logs\2023-01-26T12_33_01_788Z-debug-0.log`

Environment

  • npm: 9.3.1
  • Node: v16.14.2
  • OS: Windows 11 Pro 21H2 22000.1455 Windows Feature Experience Pack 1000.22000.1455.0
  • platform: