Some notes about npx:
-
yarn spago(oryarn run spago) will run the locally installedspago, no need to use npx for this (see https://yarnpkg.com/lang/en/docs/cli/run/#toc-yarn-run-script). -
npxhas a resolution order for running stuff. It will first check$PATH, then local packages, then if a command wasn’t found locally in either of those places, it will try to install the relevant package from the package repository (see https://github.com/npm/npx/blob/latest/README.md#description). It will not update thepackage.jsonof the project to indicate the packages that were installed. This has led my company to some hard to understand issues where things would work on one developer’s machines but not others, and makes it generally hard to reproduce system state.
Due to these points, I strongly recommend moving away from npx (my project at work has done so and the behavior of yarn run effectively supersedes npx). Note that the yarn run behavior mentioned here does not apply to npm, if you’re on npm you may still benefit from npx.