This question (How to use executables from a package installed locally in node_modules?) asked this years ago, and the correct answer is generally just npx
these days. But in a monorepo with multiple subpackages, with different dependencies in each, although it works, it is quite annoying.
my_pkg_root/ package.json
sub_pkg_1/ package.json
sub_pkg_2/ package.json
sub_pkg_3/ package.json
Or other more deeply nested structures. If in the root you install npm i myutils
providing doit
, then in my_pkg_root
, npx doit
just works. In the subpackages, what npx
(apparently) does is it first installs myutils
in the local node_modules
, runs the script, and then UNINSTALLs it. Every time.
I want a way that (using npx or other techniques) I can run doit
in any subdirectory without all the annoying overhead.