0Pricing
JavaScript Academy · Lesson

Local vs global tools, bins, and team-friendly workflows

Prefer local (project) tools over global installs; understand package "bin" commands, npm-run PATH, and simple team workflows.

Why local tools?

Goal: Run the same tools everywhere.

  • Prefer local tools (devDependencies)
  • Use npm scripts so PATH includes local node_modules/.bin
  • Understand bin entries in packages
  • Avoid global drift
Local vs global tools, bins, and team-friendly workflows — illustration 1

Local beats global

npm run automatically adds node_modules/.bin to PATH, using the project's tool version.

// Emulate running a tool locally vs globally
function runLocal() {
  console.log("npm run lint");
  console.log("→ uses node_modules/.bin/eslint (project version)");
}

function runGlobal() {
  console.log("eslint .");
  console.log("→ might use a different global version on each machine");
}

runLocal();
runGlobal();
Local vs global tools, bins, and team-friendly workflows — illustration 2

All lessons in this course

  1. package.json, scripts, and deps vs devDeps
  2. npx and semantic versioning ranges
  3. Local vs global tools, bins, and team-friendly workflows
← Back to JavaScript Academy