Skip to content

[BUG] repository URL normalization breaks non GitHub URLs #9174

@louwers

Description

@louwers

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I am publishing a package with this in its package.json:

{
  "repository": {
    "type": "git",
    "url": "https://git.sr.ht/~bl/live-server"
  }
}

I get the following error:

npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.

However, this is wrong:

$ git clone https://git.sr.ht/~bl/live-server.git
Cloning into 'live-server'...
fatal: repository 'https://git.sr.ht/~bl/live-server.git/' not found

Without the 'normalized' URL it works:

 git clone https://git.sr.ht/~bl/live-server
Cloning into 'live-server'...
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (46/46), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 84 (delta 26), reused 0 (delta 0), pack-reused 38 (from 1)
Receiving objects: 100% (84/84), 28.34 KiB | 9.45 MiB/s, done.
Resolving deltas: 100% (42/42), done.

Expected Behavior

The documentation states:

The URL should be a publicly available (perhaps read-only) URL that can be handed directly to a VCS program without any modification. It should not be a URL to an html project page that you put in your browser. It's for computers.

However, the normalization makes it impossible.

Steps To Reproduce

  1. Use any URL that doesn't end in .git.
  2. Run npm publish

Environment

  • npm: 11.11.0
  • Node.js: v25.8.1
  • OS Name: Linux
  • System Model Name:
  • npm config:
; "user" config from /home/bart/.npmrc

//npm.louwers.dev/:_authToken = (protected)
prefix = "/home/bart/.npm"

; node bin location = /nix/store/aa1vj9zdiadncjywhds4qlh8wdfay2yb-nodejs-slim-25.8.1/bin/node
; node version = v25.8.1
; npm local prefix = /home/bart
; npm version = 11.11.0
; cwd = /home/bart
; HOME = /home/bart
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions