Installing and Running Node.js

suggest change

To begin, install Node.js on your development computer.

Windows: Navigate to the download page and download/run the installer.

Mac: Navigate to the download page and download/run the installer. Alternatively, install Node with Homebrew: brew install node. Homebrew is a command-line package manager for macOS. More information is on the Homebrew website.

Linux: Follow the instructions for your distro on the command line installation page.


Running a Node Program

Run a program with node app.js, where app.js is the source file. Include the .js suffix. node app does not look for app.js. On Debian and Ubuntu the binary from the nodejs apt package was sometimes named nodejs instead of node.

Alternatively under UNIX-based operating systems, a Node program may be executed as a terminal script. To do so, it needs to begin with a shebang pointing to the Node interpreter, such as #!/usr/bin/env node. The file also has to be set as executable, which can be done using chmod. Now the script can be directly run from the command line.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents