antonwilhelm
antonwilhelm

Reputation: 7493

Can I use NPX with yarn?

I have a project that I am using yarn for. I've installed all my packages using yarn, I run yarn dev and so on. Now I'm following a tutorial that requires me to use npx to set up a package. - I'm wondering if I can just go ahead with this or if I will end up mixing things up here, as npx, as far as I know, is related to npm ?

Upvotes: 20

Views: 17740

Answers (1)

Trott
Trott

Reputation: 70085

Yes. npx will run the executable from your node_modules directory if it is installed there. If it is not, it will install the executable into a different location. It will not interfere with yarn operations.

With Yarn 2, you can also use dlx. For example:

yarn dlx create-react-app ./my-app

See https://yarnpkg.com/cli/dlx for information and options.

Upvotes: 24

Related Questions