The terminal knows about executables under node_modules/.bin through s
1 PATH Environment Variable: When you install Node.js packages locall
automatically creates symbolic links to any executable files in the
directory. However, these aren’t automatically added to your system
2 npm scripts: When you run an npm script defined in your package.jso
adds the node_modules/.bin directory to the PATH for that script ex
you can reference executables like cdk, jest, or typescript directl
without specifying the full path.
3 npx: The npx command (which comes with npm) can execute binaries fr
node_modules/.bin directory. It first checks if the command exists
trying to fetch it from the registry.
4 package managers: Tools like npm, Yarn, and pnpm handle this automa
scripts through them.