Node.js and npm basics
Node.js is the runtime that runs JavaScript outside the browser; all Playwright/Jest projects build on it.
package.json is the project's passport:
dependencies— needed at runtimedevDependencies— development/test only (Playwright goes here)scripts— shortcuts:npm run test:smoke
package-lock.json — the exact version tree; always committed to git (for reproducible installs).
npx playwright test runs the package from local node_modules (no global install needed).
| Command | What it does |
|---|---|
| npm install | installs dependencies, may update the lock file |
| npm ci | exact install from the lock file; the CI standard |
| npm run <script> | runs a command from package.json scripts |
| npx <package> | runs a package locally/temporarily |
| npm outdated / audit | outdated packages / security vulnerabilities |
📚 Sources and documentation
- Node.js API documentationofficialnodejs.org
- package.jsonofficialdocs.npmjs.com