Skip to content

[BUG] npx no longer works with github: registry #5134

@mike-potter

Description

@mike-potter

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

When using Node v18.4.0 or later (npm 8.12.1 or later), referencing a Github repo via:

npx github:org/project.git

gives the error:

@org/[email protected]' is not in this registry.

In past versions of npx this worked fine and would create a package.json in ~/.npm/_npx/HASH/package.json that contained:

{
  "dependencies": {
    "@org/project": "github:org/project"
  }
}

but in the new versions of npx it seems to be trying to resolve the project in the main npm registry rather than using Github.

I also tried using a full Github URL path instead of just github: and got the same error.

When I look at the nvm log, older versions that worked show:

40 silly idealTree buildDeps
41 silly fetch manifest @org/project@github:org/project
42 silly placeDep ROOT @org/[email protected] OK for:  want: github:org/project
43 timing idealTree:#root Completed in 428ms

but the nvm log for latest version that doesn't work shows:

40 silly idealTree buildDeps
41 silly fetch manifest @org/[email protected]
42 http fetch GET 404 https://registry.npmjs.org/@org%2fproject 377ms (cache skip)
43 http fetch GET 404 https://registry.npmjs.org/@org%2fproject 181ms (cache skip)
44 silly placeDep ROOT @org/project@ OK for:  want: 1.0.0
45 timing idealTree:#root Completed in 567ms

Notice how the latest version is trying to use 1.0.0 and registry.npmjs.org instead of github

Expected Behavior

Expected to download the repo package.json and execute a command.

Steps To Reproduce

When using Node v18.4.0 or later (npm 8.12.1 or later)

npx -y github:org/project.git

gives the error:

@org/[email protected]' is not in this registry.

(org and project removed for privacy)

Environment

  • npm: 8.12.1 or later
  • Node.js: 18.4.0 or later
  • OS Name: Mac OSX 12.3
  • System Model Name: Macbook
  • npm config:
; node bin location = /Users/myname/.nvm/versions/node/v18.4.0/bin/node
; node version = v18.4.0
; npm local prefix = /Users/myname/Projects/temp
; npm version = 8.12.1
; cwd = /Users/myname/Projects/temp
; HOME = /Users/myname
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions