Typorithm · medium

npm commands

npm-commandsnodejsinstalldev-depsnpx
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn npm commands

0%

Modules & npm

npm install adds dependencies; --save-dev marks dev-only tools; npm run executes scripts; npx runs a package's binary without a global install; npm ci does a clean, lockfile-exact install for CI.

npm install with no arguments reads package.json and installs everything into node_modules; with a package name it adds that package and records it in dependencies.

Adding --save-dev puts the package under devDependencies — tools like linters and test runners needed for development but not at runtime. npm run <name> executes a script defined in package.json.

npx runs a package's executable (using a local copy or fetching it on the fly), so you can invoke CLIs without a global install. npm ci wipes node_modules and installs the exact versions from package-lock.json — fast and reproducible for CI.

01

npm install adds/installs dependencies.

02

--save-dev records a devDependency.

03

npm ci installs exactly the lockfile for CI.

npm install
npm install eslint --save-dev
npm run build
npx tsc --init
npm ci

Read the implementation

Connect each part of the code to the concept before you type.

1. Install deps

npm install reads package.json and installs all dependencies into node_modules.

npm install

2. Dev dependency

--save-dev records the package under devDependencies, for tooling not shipped at runtime.

npm install eslint --save-dev

3. Run a script

npm run executes the named scripts entry from package.json.

npm run build

4. Run a tool

npx runs a package's binary, using a local install or fetching it temporarily.

npx tsc --init

5. Clean install

npm ci installs exactly the versions in package-lock.json for reproducible CI builds.

npm ci

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

npm commands: Lesson & Practice · Typorithm | ApplyDjinn