DEV Community

Mateo Tibaquirá
Mateo Tibaquirá

Posted on • Edited on

A word of npx-advice

Node.js dependency managers like NPM and YARN does support the easy execution of starter-kit-packages to bootstrap or create the boilerplate of many kinds of projects, like create-npm which bootstraps a package by running:

npm create npm github-user/my-pkg

yarn create npm github-user/my-pkg
Enter fullscreen mode Exit fullscreen mode

These packages starts with create-* and the create command forwards any <args> to the binary, so

yarn create nx-plugin my-workspace --pluginName my-plugin
Enter fullscreen mode Exit fullscreen mode

is equivalent to

yarn global add create-nx-plugin
create-nx-plugin my-workspace --pluginName my-plugin
Enter fullscreen mode Exit fullscreen mode

I do usually use create-nx-workspace and recently I wanted to re-take my experiments with Nx so I created a new workspace with npx create-nx-workspace --preset angular and I got an outdated setup.

I was wondering if the package was not being maintained properly (which was very unlikely) but then I realized that I installed it globally many months ago for some reason, and I didn't update it since then...

Best Practice

Try to not install packages globally which gets easily outdated, and please never install a starter package globally. Just run the latest version with npm create or yarn create or npx.

We have to get used to run the local dependencies via npm run command or yarn command instead having global dependencies that can give us headaches after some time.

Top comments (0)