Installing Node.js and Using the Node CLI
The node command is the primary CLI for executing JavaScript files and interacting with the Node.js runtime. You can verify your installation using node --version and npm --version.
Node also provides a REPL, which is useful for experimenting with JavaScript and Node APIs interactively.
Using a Node.js version manager such as nvm makes it easier to switch between Node.js versions for different projects.
node --version
npm --version
node
node app.jsThe first two commands display installed versions, node starts the REPL, and node app.js executes a JavaScript file.
Use
node filename.jsto execute a Node.js application.The Node REPL is useful for quickly testing JavaScript expressions.
Keep project Node.js versions consistent across development and production.
Which command executes server.js?