Check the NPM docs for install:
With the
--productionflag (or when theNODE_ENVenvironment variable is set to production), npm will not install modules listed indevDependencies.The
--only={prod[uction]|dev[elopment]}argument will cause either only devDependencies or only non-devDependencies to be installed regardless of the NODE_ENV.
Have you tried the following?
npm install --only=dev