Node.js
The terminal says command not found: node. Why can't my project run?
The terminal says command not found: node. Why can't my project run?
const fs = require("fs");
const files = fs.readdirSync("./data");
console.log(`Read ${files.length} item(s)`);const fs = require("fs");
const files = fs.readdirSync("./data");
console.log(`Read ${files.length} item(s)`);The browser just shows the file as text; it does not run itJavaScript has two common runtimes: pages in a browser and Node.js in a terminal. Project commands, npm, and build tools all run on the latter.
It is a runtime, not a new language: You still write JavaScript. Node.js adds the ability to execute it on a computer, so scripts run without opening a browser.
Build and package tools depend on it: npm installing dependencies, build commands, and AI development tools themselves all run on Node.js. Without it, project commands fail with command not found.
Projects require specific versions: When docs say requires Node 18+, run node -v to see the local version; upgrade before running if it is too low.
The terminal reports command not found: node. First check whether Node.js is installed here and its version; if it is missing or below the project requirement, tell me which version to install, then rerun the project command and confirm it starts.