how does npm run work? how does npm run work? shell shell

how does npm run work?


npm run-script <command> uses sh -c to run the command, and cmd /d /s /c on windows. (source) It is run by child_process.spawn.

npm env lists the environment that npm uses when it runs commands. The documentation lists some of the things it adds to the environment. This includes everything from package.json, the PATH additions you mentioned and more.

&and && are handled by the shell, but spawn is waiting for the process to end, even when it is put in the background by &. && is working as you are used to in sh.

globstar will work as you expect, except on Windows where you have wildcards instead.