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 <gist> leads to command not found #5132

Closed
2 tasks done
kentcdodds opened this issue Jul 7, 2022 · 6 comments
Closed
2 tasks done

[BUG] npx <gist> leads to command not found #5132

kentcdodds opened this issue Jul 7, 2022 · 6 comments
Assignees
Labels
Bug thing that needs fixing cmd:exec related to `npx` Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release ws:libnpmexec Related to the libnpmexec workspace

Comments

@kentcdodds
Copy link
Contributor

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

I'm trying to run:

npx https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733

However I get:

sh: workshop-setup: command not found

For context, I use this for step of my workshop repositories. It checks that learner's machines have the correct versions of things installed, installs dependencies, and runs validation to make sure things were installed correctly. This worked before I updated to npx v8.

Expected Behavior

I expect the bin of the gist's package.json to be run as previous versions of npx as recent as v7.

Steps To Reproduce

  1. In any environment
  2. With any config
  3. Run npx https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733
  4. See the above error

Environment

  • npm: latest
  • Node.js: latest
  • OS Name: any
  • System Model Name: any
  • npm config: any

(All my students are running into this. Even my CI: https://github.com/kentcdodds/react-fundamentals/runs/6989184285?check_suite_focus=true)

@kentcdodds kentcdodds 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
@nlf
Copy link
Contributor

nlf commented Jul 13, 2022

it looks like what's going on here is that the package.json in your gist has the name workshop-setup but since this package is also published to the npm registry, we're reading the package.json file for a name and then installing the package from the registry instead of the gist.

this is very clearly a bug. thanks for the report!

@nlf nlf added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Jul 13, 2022
@kentcdodds
Copy link
Contributor Author

That's great! Thank you for looking into this. I tried removing the name and setting it to @kentcdodds/workshop-setup and neither of those solutions worked. Is there a workaround I can use until this is fixed?

@gengjiawen
Copy link

That's great! Thank you for looking into this. I tried removing the name and setting it to @kentcdodds/workshop-setup and neither of those solutions worked. Is there a workaround I can use until this is fixed?

Another way is downgrade npm.

npm i -g npm@6

@wraithgar
Copy link
Member

Duplicate issue here w/ some more comments: #5134

@wraithgar wraithgar self-assigned this Jul 21, 2022
@wraithgar wraithgar added Priority 1 high priority issue ws:libnpmexec Related to the libnpmexec workspace and removed Priority 2 secondary priority issue labels Jul 21, 2022
@fritzy fritzy added the cmd:exec related to `npx` label Jul 25, 2022
@wraithgar
Copy link
Member

wraithgar commented Aug 3, 2022

This should be fixed as of [email protected]

~/D/n/s/empty $ npx gist:a5a65137bd390864e294ec80bb91e005
Need to install the following packages:
  gist:a5a65137bd390864e294ec80bb91e005
Ok to proceed? (y) 
Hi there! I am @gar/npm-exec-gist version 1.0.0

lopopolo added a commit to artichoke/artichoke that referenced this issue Aug 23, 2022
The GitHub Actions runner contains a version of `npx` that is bugged:

- npm/cli#5132

```
npm WARN exec The following package was not found and will be installed: @artichokeruby/[email protected]
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@artichokeruby%2fclang-format - Not found
npm ERR! 404
npm ERR! 404  '@artichokeruby/[email protected]' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
```

Work around this by pinning the node and npm versions.
@lopopolo
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing cmd:exec related to `npx` Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release ws:libnpmexec Related to the libnpmexec workspace
Projects
None yet
Development

No branches or pull requests

6 participants