The usual way of installing only devDependencies was to use npm install --only=dev
(or --only=production
if you want only dependencies).
This doesn't work anymore in 8.7. If I run this command, npm will try installing all dependencies. Or at least, it runs a /usr/bin/git ls-remote -h -t
on packages that are not in devDependencies
. Those packages being in private git repos, the npm install fails for me.
This didn't happen until I upgraded to 8.7.0, from 7.4.0
The npm cli documentation still shows the old way of doing it though.
Is there a new syntax for that option?
From the output of npm help install
:
npm install (in package directory, no arguments):
Install the dependencies in the local node_modules folder.
In global mode (ie, with
-g
or--global
appended to the command), it installs the current package context (ie, the current working directory) as a global package.By default,
npm install
will install all modules listed as dependencies in npm help 5package.json
.With the
--production
flag (or when theNODE_ENV
environment variable is set toproduction
), npm will not install modules listed indevDependencies
.
So it seems you can install only dependencies
with --production
; not sure if there's a way to only install devDependencies
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With