Recently, I’ve faced with interesting research task at work related to AzureDevOps as a CI platform and NodeJS/npm as targeted resource. Our pipeline yaml
file was configured to run npm command with deprecated flag – npm ci --dev
and as turned out for npm@<7 it’s suggested to use --also=dev
and for npm@>7 is suggested to use --include=dev
. But when I tried different variants, to be sure if it works at all or not I saw no difference.
I always knew that npm ci
designed to run specifically on CI (at least due to the fact that node_modules
is being deleted and package-lock.json
file recreated). But I didn’t know how environmental variable NODE_ENV
value (either not set, development
or production
) actually influences work of npm
. Reading npm documentation, Stackoverflow questions and answers it’s not always clear how it works. Yes, I know, that npm ci
under the hood is actually npm install
(alias npm i
), but still both commands give us different behavior.
By default I always use npm ci
(as it’s suggested to run on CI) on my CI instances (Jenkins, CircleCI, Heroku) so it always installed devDependencies
for me and I never intended to include or omit. Work use case got me thinking more, so I decided to research very detailed.
Continue reading “How to install devDependencies in NODE_ENV=production?”
You must be logged in to post a comment.