DEV Community

Discussion on: npm vs npx - which to use when?

Collapse
mburszley profile image
Maximilian Burszley • Edited on

That's not an equal comparison. Npm and Yarn are the comparison and Yarn integrates what npm calls npx into its command without needing to call a different command.

All npx does is add the .bin folder to your path before searching for a command to execute, in essence.

Collapse
suchitra_13 profile image
Suchitra

I know this is not a good comparision but I have a doubt in mind that .. in case of "npm" if we don't want to install some dependency locally we generally use "npx".
So, in case of "yarn" package manager what should we use when we don't want to instally some dependency!
Nutshell "yarn" is the alternative of "npm" so, what is alternative of "npx" in terms of "yarn" package manager??

Thread Thread
mudasirh profile image
Mudasir Habib

Basically yarn is just an improvement to npm. Yarn consume the same package.json format and can install npm packages.