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 with github scheme will fail without any message #5749

Closed
2 tasks done
anatawa12 opened this issue Oct 26, 2022 · 6 comments
Closed
2 tasks done

[BUG] npx with github scheme will fail without any message #5749

anatawa12 opened this issue Oct 26, 2022 · 6 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@anatawa12
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

npx github:viperproject/check-license-header#v1

falls (exits 1) without any error message

Expected Behavior

npx github:viperproject/check-license-header#v1

run viperproject/check-license-header

Steps To Reproduce

  1. With node 16.18.0 and npm 8.19.2
  2. With no (additional) configuration
  3. Run npx github:viperproject/check-license-header#v1

Environment

  • npm: 8.19.2
  • Node.js: v16.18.0
  • OS Name: macOS Ventura 13.0
  • System Model Name: MacBookPro 14-inch, 2021
  • npm config:
; node bin location = /opt/n/bin/node
; node version = v16.18.0
; npm local prefix = /Users/anatawa12/IdeaProjects/fixRTM
; npm version = 8.19.2
; cwd = /Users/anatawa12/IdeaProjects/fixRTM
; HOME = /Users/anatawa12
; Run `npm config ls -l` to show all defaults.
@anatawa12 anatawa12 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 Oct 26, 2022
@anatawa12
Copy link
Author

anatawa12 commented Oct 26, 2022

I found npmBin passed to GitFetcher in pacote is path to npx-cli.js, not a npm and GitFetcher[_prepareDir] executes node npx-cli.js install <options....> so git dep preparation will be failed.

@anatawa12 anatawa12 changed the title [BUG] <title> [BUG] npm with github scheme will fail without any message Oct 26, 2022
@anatawa12
Copy link
Author

flat.npmBin = require.main ? require.main.filename

I think this line is the problem. the XXX says using npm programmatically is a bit of a pain.

@anatawa12
Copy link
Author

And on the latest branch, here's the problem.
I've tested npm v9 but this problem still exiets.

// XXX make this the bin/npm-cli.js file explicitly instead
// otherwise using npm programmatically is a bit of a pain.
flat.npmBin = require.main ? require.main.filename
: /* istanbul ignore next - not configurable property */ undefined
flat.nodeBin = process.env.NODE || process.execPath

@nlf nlf changed the title [BUG] npm with github scheme will fail without any message [BUG] npx with github scheme will fail without any message Feb 16, 2023
@nlf nlf added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Feb 16, 2023
@nlf
Copy link
Contributor

nlf commented Feb 16, 2023

good catch! the mix up between the npx bin and the npm bin is definitely what's broken here

@milaninfy
Copy link
Contributor

This appears to be fixed on latest npm

~ $ npx github:viperproject/check-license-header#v1 check
check-license-header check

Check license headers

Options:
      --version  Show version number                                   [boolean]
  -c, --config   Path to JSON config file                    [string] [required]
      --path     Path to working directory[string] [default: "/Users/milaninfy"]
  -h, --help     Show help                                             [boolean]
      --strict   Specifies whether files not covered by the configuration should
                 be treated as errors                 [boolean] [default: false]

Missing required argument: c
Please specify path to config file
~ $ npm -v
10.8.3
~ $ npx -v
10.8.3

@anatawa12
Copy link
Author

it looks fixed by #6762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

3 participants