0
0
Node.jsframework~10 mins

package-lock.json and deterministic installs in Node.js - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to install dependencies exactly as specified in package-lock.json.

Node.js
npm [1]
Drag options to blanks, or click blank then click option'
Aci
Binstall
Cupdate
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm install' which may update dependencies.
Using 'npm update' which changes versions.
Using 'npm run' which executes scripts, not installs.
2fill in blank
medium

Complete the code to generate a package-lock.json file after installing dependencies.

Node.js
npm [1]
Drag options to blanks, or click blank then click option'
Aci
Block
Cinstall
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm ci' which requires an existing lock file.
Using 'npm update' which changes versions.
Using 'npm lock' which is not a valid command.
3fill in blank
hard

Fix the error in the command to ensure deterministic installs using package-lock.json.

Node.js
npm [1]
Drag options to blanks, or click blank then click option'
Aupdate
Binstall --no-package-lock
Cinstall --package-lock-only
Dci
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install --no-package-lock' which disables lock file usage.
Using 'install --package-lock-only' which only updates the lock file.
Using 'update' which changes dependency versions.
4fill in blank
hard

Fill both blanks to create a script in package.json that runs deterministic installs.

Node.js
""
{
  "scripts": {
    "deterministic-install": "npm [1] --prefer-offline --no-audit --progress=false [2]"
  }
}
"""
Drag options to blanks, or click blank then click option'
Aci
Binstall
C--frozen-lockfile
D--no-package-lock
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'ci' for deterministic installs.
Using '--no-package-lock' which disables lock file usage.
Omitting '--frozen-lockfile' which allows lock file updates.
5fill in blank
hard

Fill all three blanks to explain the role of package-lock.json in deterministic installs.

Node.js
"""
The package-lock.json file [1] the exact versions of dependencies installed.
It [2] the dependency tree to ensure consistent installs.
Using npm [3] installs dependencies exactly as locked.
"""
Drag options to blanks, or click blank then click option'
Arecords
Blocks
Cci
Dupdates
Attempts:
3 left
💡 Hint
Common Mistakes
Saying the file 'updates' versions instead of locking them.
Using 'install' instead of 'ci' for deterministic installs.
Confusing 'records' with 'updates' in the first blank.