Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
mike-potter opened this issue Jul 7, 2022 · 8 comments
Closed
2 tasks done

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

mike-potter opened this issue Jul 7, 2022 · 8 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@mike-potter
Copy link

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.
@mike-potter mike-potter added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jul 7, 2022
@mike-potter
Copy link
Author

Here is the npm config for node 18.5.0 that has the same problem:

; node bin location = /Users/myname/.nvm/versions/node/v18.5.0/bin/node
; node version = v18.5.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.

the log file has the same references to registry.npmjs.org shown above for 18.4.0

@mike-potter
Copy link
Author

And then I force updated npm to the latest version via npm install -g npm@latest and it still failed. Here is that npm config:

; node bin location = /Users/myname/.nvm/versions/node/v18.5.0/bin/node
; node version = v18.5.0
; npm local prefix = /Users/myname/Projects/temp
; npm version = 8.13.2
; cwd = /Users/myname/Projects/temp
; HOME = /Users/myname
; Run `npm config ls -l` to show all defaults.

@mike-potter
Copy link
Author

Last known npm version where it was working is 8.11.0

@nlf
Copy link
Contributor

nlf commented Jul 13, 2022

i'm not able to reproduce this one so far:

> npx -y github:npm/cli --version
8.14.0

is this happening for you with any package coming from github, or only some specific subset? does the command that worked for me above work for you?

@cspotcode
Copy link
Contributor

I was seeing that it erroneously tries to talk to npmjs.com when it should be talking to GitHub. I'm guessing if you try to run something off of GitHub, but it's been published to npm, then it'll appear to work while the bug happens behind the scenes. Maybe try with something on GitHub that is known to not exist on npm.

@mike-potter
Copy link
Author

The npx -y github:npm/cli --version works for me here. But using a public repo that has never been published to npm does not work. But confirmed works fine in npm 8.11.0, just not in later versions.

@mike-potter
Copy link
Author

Confirmed that the test with github:npm/cli doesn't actually pull it from github. The cached package.json in the .npm/_npx folder is:

  "dependencies": {
    "npm": "^8.14.0"
  }
}

and is missing any reference to github.

@wraithgar
Copy link
Member

This is the same root cause as #5132, which has already been triaged and prioritized. Closing this as a dupe and making a note there about this issue existing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

4 participants