DEV Community

loading...

Discussion on: What is NPX?

Collapse
yvesgurcan profile image
Yves Gurcan

Thanks for sharing! I was excited when npx came out but it turns out that I went a different way: All the packages I need for a project are references in the dependencies in package.json. That way, you don't need to worry about installing something globally at all. I also find it safer to make my projects as self contained as possible. What do you think? Any cons to my method?

Collapse
matheusgomes062 profile image
Matheus Gomes 👨‍💻 Author

I think this is a good way to install the packages, actually is the right way in my opinion. I think npx is more to try packages, and to use with cli, so we don't need to install every time someone wants to see your project.

Collapse
yvesgurcan profile image
Yves Gurcan

Ah, that's right! Once I install the dependency, I write an npm script to run it and if it does not work for me I just remove the dependency and the script. I can see how npx would make it easier for me, as I wouldn't have to use that npm script intermediary when I'm figuring out how the package works. Nice.