[BUG] Cannot install git package without HEAD ref

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
git, javascript
Domain
cli

Research direction

Start by reproducing the npm install command from the issue against a repository whose HEAD reference is unavailable, then trace the git reference resolution path that produces the undefined sha error. Done means the specified branch, commit hash, or tag can be installed without requiring a HEAD reference.

Written by the indexing model from the issue text.

Description

Needs Triage
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:
Dominant language
JavaScript
Stars
76
Forks
31
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from npm/git

All issues in npm/git

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.