Does running an npm package with npx cause devDependencies to get installed?

Viewed 952

I'm finding it difficult to get a clear answer to this on the web. When you run a command in a package with npx (eg, npx mypackage sayhello), are the devDependencies within that package installed? I'm guessing yes, but not certain.

2 Answers

npx is just a tool that allows you to execute packages without having to install them globally (npx doesn't install packages). npx is just used for executing packages from the npm registry.

npx does install the packages however only for temporary use.

$ npx pm2
Need to install the following packages:
  pm2
Ok to proceed? (y) y
...
...

$ npm ls -g
/home/user/.node/
+-- npm@7.19.1
`-- typescript@4.3.5

You can even check out this answer for more details

Where does NPX store binaries after installation?

I have just tested this, and it appears the answer is: no.

Related