Skip to content

Fix broken repository URL in package.json - #25

Merged
mcollina merged 1 commit into
nodejs:mainfrom
ExplodingCabbage:patch-1
Nov 25, 2026
Merged

mcollina merged 1 commit into
nodejs:mainfrom
ExplodingCabbage:patch-1

Conversation

@ExplodingCabbage

Copy link
Copy Markdown
Contributor

GitHub hasn't supported the git protocol since 2022, so this URL is broken.

(This is a common error affecting many popular npm packages; I'm opening PRs on several projects to fix it. I encourage anyone reading this to check any packages they maintain and implement the same fix if appropriate!)

GitHub hasn't supported the git protocol [since 2022](https://github.blog/security/application-security/improving-git-protocol-security-github/#no-more-unauthenticated-git), so this URL is broken.

(This is a common error affecting many popular npm packages; I'm opening PRs on several projects to fix it. I encourage anyone reading this to check any packages they maintain and implement the same fix if appropriate!)
Comment thread package.json
"repository": {
"type": "git",
"url": "git://github.com/nodejs/string_decoder.git"
"url": "https://github.com/nodejs/string_decoder.git"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"url": "https://github.com/nodejs/string_decoder.git"
"url": "git+https://github.com/nodejs/string_decoder.git"

npm pkg fix normalizes to the protocol git+https

See https://docs.npmjs.com/cli/v12/configuring-npm/package-json#repository

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That seems bizarre - that's not even valid syntax for a Git remote! If you try doing git clone 'git+https://github.com/nodejs/string_decoder' or setting such a remote in your .git/config, it will fail. I have no idea why npm pkg fix wants you to set your remote URL to something that from Git's perspective isn't even syntactically valid, but personally, I would ignore it.

@MikeMcC399 MikeMcC399 Nov 18, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You'll find it on more up to date packages like https://github.com/nodejs/undici/blob/main/package.json

I don't know if this repo is ever going to be republished. The last publication was 7 years ago. So it may be that the change never gets used.

I just happened to notice your PR when I was looking at other things in this repo.

Also used by npm itself:

  "repository": {
    "type": "git",
    "url": "git+https://github.com/npm/cli.git"
  },
@mcollina
mcollina merged commit 36ebd2c into nodejs:main Nov 25, 2026
@MikeMcC399

Copy link
Copy Markdown
Member

This should get normalized if the package is republished.

image

It would be cleaner to fix it in the repo, but it's not absolutely necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants