node-docker-good-defaults icon indicating copy to clipboard operation
node-docker-good-defaults copied to clipboard

Use npm ci instead of npm install?

Open vitalets opened this issue 3 years ago • 3 comments

Isn't it better to use npm ci instead of npm install here we get exactly same node_modules by package-lock.json?

vitalets avatar Apr 14 '21 09:04 vitalets

Initially, npm ci would fix to lock yes, but would also install dev dependencies always, which I didn't want. Do you know if they've fixed that?

BretFisher avatar Apr 19 '21 02:04 BretFisher

At least in [email protected] npm ci does not install devDeps if NODE_ENV is 'production' or the --production flag is set.

If you've a multistage build that starts with a development NODE_ENV and ends in a production one, you can use npm prune to get node_modules to a production only state.

earnubs avatar Apr 19 '21 17:04 earnubs

Sounds good, thanks!

BretFisher avatar Apr 21 '21 04:04 BretFisher