Skip to content

Instantly share code, notes, and snippets.

@Tynael
Last active Nov 15, 2022
Embed
What would you like to do?
How to use npx to run gist based scripts
#!/usr/bin/env node
console.log("I was executed from a gist inside the terminal with npx!");
{
"name": "run-js-with-npx-from-gist",
"version": "1.0.0",
"bin": "./index.js"
}
@dagolinuxoid
Copy link

dagolinuxoid commented Jan 24, 2020

You did a good job of explaining npx

@xerosanyam
Copy link

xerosanyam commented Jan 25, 2020

yes, truly amazing :)

@lantosgyuri
Copy link

lantosgyuri commented Feb 4, 2020

🎉 🎉 🎉 Thanks for this article!

@robert-rae
Copy link

robert-rae commented Feb 13, 2020

hahaha this is great, thanks!

@mmRoshani
Copy link

mmRoshani commented Mar 5, 2020

👍👍👍

@romualdovillalobos
Copy link

romualdovillalobos commented Mar 10, 2020

Amazing!! thanks

@maan-singh
Copy link

maan-singh commented Apr 12, 2020

nice

@Tynael
Copy link
Author

Tynael commented Jun 5, 2020

@dagolinuxoid, @xerosanyam, @lantosgyuri, @robert-rae, @MohammadMojtabaRoshani-TOMaaR, @romualdovillalobos, @maan-singh
Thank you for the kind words, folks! I really hope it helped you!

@fredsced
Copy link

fredsced commented Jun 13, 2020

Thanks for the explanation

@RyotaBannai
Copy link

RyotaBannai commented Jun 21, 2020

Such an awesome feature I've never imagined the mere local command being capable of this! Thank you for this education!

@mdn-cloud
Copy link

mdn-cloud commented Jul 15, 2020

It was really helpful for me as a new learner!!! thanks a lot!!

@jonasmateus
Copy link

jonasmateus commented Aug 23, 2020

This example was extremely helpful! Thanks a lot :)

@lukaskoeller
Copy link

lukaskoeller commented Sep 4, 2020

Is there any possibility to have arguments in the scripts which values are provided through options in the npx command?
Something like: npx <url-to-gist> --source ./path/to/source --dest ./path/to/dest?

@Tynael
Copy link
Author

Tynael commented Sep 9, 2020

Thank you, @fredsced, @RyotaBannai, @mdn-cloud, @jonasmateus.

@lukaskoeller I don't know tbh, haven't tried that yet ^^

@Temi-t
Copy link

Temi-t commented Dec 18, 2020

Thanks. This was helpful

@sa2kasov
Copy link

sa2kasov commented Dec 30, 2020

I've read your article in russian from here

@jtello
Copy link

jtello commented Apr 21, 2021

Thanks!

@bennythejudge
Copy link

bennythejudge commented Apr 27, 2021

thanks!!

@fesantossp
Copy link

fesantossp commented May 12, 2021

Thanks for the article!!

@ydjaghloul
Copy link

ydjaghloul commented Jun 4, 2021

very nice, thanks

@Tynael
Copy link
Author

Tynael commented Jun 7, 2021

@ashiquem
Copy link

ashiquem commented Jun 10, 2021

Super clear explanation and very helpful, thanks!

@Tynael
Copy link
Author

Tynael commented Jun 24, 2021

Thanks, @ashiquem!

I've also created a video on this subject if you prefer this format. You can check it out here:

https://www.youtube.com/watch?v=fSHWc8RTJug

@zjkuang
Copy link

zjkuang commented Mar 3, 2022

Amazing!!! I tried with my gist and it is working like a charm!

@codcarry
Copy link

codcarry commented Nov 15, 2022

Thanks sharing about npx ~ Here I have a problem ,the time when I run "npx https://gist.github.com/Tynael/0861d31ea17796c9a5b4a0162eb3c1e8" ,my terminal show below words "[..................] - rollbackFailedOptional: verb npm-session e08d5c3184bda02a".I want to konw what happened.
Looking forward to your recovery~

@Tynael
Copy link
Author

Tynael commented Nov 15, 2022

Hi @codcarry!
That is a npm specific issue that can have many different causes of malfunction.
I suggest having a look on Google and see what works for you: https://www.google.com/search?q=-+rollbackFailedOptional%3A+verb+npm-session&sourceid=chrome&ie=UTF-8

@codcarry
Copy link

codcarry commented Nov 15, 2022

Thanks very much,I'll try to resolve this.

Hi @codcarry! That is a npm specific issue that can have many different causes of malfunction. I suggest having a look on Google and see what it works for you: https://www.google.com/search?q=-+rollbackFailedOptional%3A+verb+npm-session&sourceid=chrome&ie=UTF-8

Thanks very much,I'll try to resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment