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] exec/npx: npm v8.8+/9+ break with a self-reference #5777

Closed
2 tasks done
ljharb opened this issue Oct 30, 2022 · 6 comments · Fixed by #5832 or #5842
Closed
2 tasks done

[BUG] exec/npx: npm v8.8+/9+ break with a self-reference #5777

ljharb opened this issue Oct 30, 2022 · 6 comments · Fixed by #5832 or #5842
Assignees
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 8.x work is associated with a specific npm 8 release Release 9.x work is associated with a specific npm 9 release

Comments

@ljharb
Copy link
Collaborator

ljharb commented Oct 30, 2022

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

In a package foo with a bin, run npx foo, and you'll see sh: foo: command not found.

Expected Behavior

In a package foo with a bin, run npx foo, and the bin is invoked.

Steps To Reproduce

  1. Clone any repo, presumably, but in this case, https://github.com/ljharb/publishers
  2. Run npx [email protected] exec publishers, see that it invokes the binary properly.
  3. Run npx [email protected] exec publishers, see that it errors.

Environment

  • npm: <= 8.7, >= 8.8
  • Node.js: 19
@ljharb ljharb added Release 8.x work is associated with a specific npm 8 release Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Oct 30, 2022
@darcyclarke darcyclarke added Priority 0 will get attention right away and removed Needs Triage needs review for next steps labels Nov 1, 2022
@wraithgar
Copy link
Member

Duplicate of #5730

@wraithgar wraithgar marked this as a duplicate of #5730 Nov 2, 2022
@wraithgar
Copy link
Member

Nope sorry wrong issue

@ljharb
Copy link
Collaborator Author

ljharb commented Nov 9, 2022

Yay, thanks!

@lukekarrys
Copy link
Contributor

Running the original steps to reproduce, I get a different error with 9.1.1:

❯ npx --version
9.1.1

❯ pwd
/Users/lukekarrys/projects/ljharb/publishers

❯ npx publishers
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'json-colorizer'
Require stack:
- /Users/lukekarrys/projects/ljharb/publishers/bin/publishers
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/lukekarrys/projects/ljharb/publishers/bin/publishers:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/lukekarrys/projects/ljharb/publishers/bin/publishers' ]
}

Node.js v18.12.1

@ljharb
Copy link
Collaborator Author

ljharb commented Nov 10, 2022

Thanks for noticing; I hadn't had a chance to verify yet.

@ljharb
Copy link
Collaborator Author

ljharb commented Nov 16, 2022

Confirmed that my issue is fixed as of v9.1.1, but this can stay open til #5842 lands.

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 0 will get attention right away Release 8.x work is associated with a specific npm 8 release Release 9.x work is associated with a specific npm 9 release
Projects
None yet
4 participants