Why coding agents should use npm ci and how to handle install scripts
The article argues that the npm command a coding agent runs after cloning a Node repository matters, since npm install can alter the lockfile and run install scripts. It explains that npm ci requires an existing lockfile, fails rather than reconciling mismatches with package.json, never writes project files, and starts from a clean node_modules. Because npm ci still executes package install scripts, the author suggests the --ignore-scripts flag, then selectively trusting specific packages via npm rebuild. The piece also recommends pairing agent instructions with enforcement hooks and a committed .npmrc, since instruction files alone are only requests.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in