CS FundamentalsModerateProduct-company placement · Node.js interview
Two developers run npm install on the same commit a month apart and get different dependency versions, though package.json is unchanged. What prevents this?
- A. Deleting node_modules every day
- B. Pinning Node.js to the latest version
- C. Using only caret ranges
- D. Committing the lock file (package-lock.json) and installing from it, e.g. with npm ci
Correct answer: D. Committing the lock file (package-lock.json) and installing from it, e.g. with npm ci
Ranges in package.json resolve to whatever is newest at install time; the lock file records the exact resolved tree. npm ci installs exactly that tree, giving reproducible builds.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Your app depends on libraries P and Q. P needs utils >=2.0 <3.0 and Q needs utils >=1.2 <2.0. In an ecosystem that allows only one version…
- How many of these refactoring statements are correct? 1. A refactoring must not change the observable behaviour of the code. 2. A good…
- A structure chart shows a date-formatting utility called by 14 modules (high fan-in) and a controller module that calls 23 different…
- A team keeps postponing cleanup of a hard-coded module: each new feature touching it now takes three days instead of one. In the…
- A UML state machine has the transition Idle → Processing labelled 'submit [cart not empty] / validateCart()'. What do the three parts mean?
- A team draws one UML diagram showing which artefacts (JARs, containers) run on which nodes (servers, devices) and how the nodes…