-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
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
Running the following command does not work:
npm install git+ssh://[email protected]:1example/common-code.git
Note that 1example/common-code.git is not a real repository. It is just used to demonstrate the issue.
The problem is that the group/namespace/org part that is named 1example in this example begins with a number. The full format for the npm install command for this is as follows:
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
Here we can clearly see that the : can be used for both the port and the path parts. So I guess that because 1example begins with a number it is treated as the port and therefore this fails. Note that I am not sure this is the case, just a guess based on the behaviors I have seen.
Expected Behavior
I would expect that 1example is treated as a group/namespace/org and not as a port since 1exampleis not a valid port.
I would expect that the npm install git+ssh://[email protected]:1example/common-code.git command works and the package is installed (assuming the command actually points to a real repository which it is not in this example)
Steps To Reproduce
- Create a git repository inside a group/namespace/org that begins with a number
- run
npm install git+ssh://[email protected]:<group/namespace/org>/<repo.name>.gitagainst the repository that was created in step 1
Environment
- npm: 9.8.1
- Node.js: v18.18.1
- OS Name: Ubuntu 20.04.06 and in Rocky Linux 9.3
- System Model Name: Not Relevant
- npm config: empty