Need to run JavaScript outside a browser or start a local web server? Node.js provides a JavaScript runtime for Windows, using Google’s V8 engine to execute scripts and server-side code.
JavaScript runtime and event loop
Run a script from the command line with Node.js, for example by passing a JavaScript file to the node command. This lets the same language power server-side programs, local development servers, and build tools as well as code that runs in a browser.
Node.js uses V8 to execute JavaScript and an event loop to coordinate asynchronous work. While one operation waits for an input or network response, the runtime can handle other events. That model suits web services that receive overlapping requests, including interactive applications and streaming platforms. CPU-heavy synchronous code can still hold up other work on the event loop.
npm packages and project scripts
The installation includes npm, the package manager used to add JavaScript libraries and command-line tools to a project. Developers commonly keep a project’s dependency information and runnable scripts in package.json. After setting up a project’s packages, npm commands can run its defined tasks, such as tests or build steps.
This workflow also supports tools built on Node.js, including development servers and front-end build systems. A project can specify its dependencies and scripts so collaborators can install the same packages and run the same named tasks.
- Install dependencies with npm install.
- Run a project task with npm run followed by its script name.
Server-side modules
Node.js includes built-in modules for common tasks. The http module can create a server that receives and responds to web requests; other core modules handle work such as reading files. These APIs let an application perform server tasks directly in JavaScript, while npm packages add capabilities beyond the modules included with the runtime.
Pros
- Runs JavaScript scripts with the V8 engine
- Includes npm for installing project packages
- Asynchronous request handling supports web services
- Built-in HTTP module can serve web requests
Cons
- Long-running synchronous JavaScript can block the event loop
System requirements: Windows 10, Windows 11
Does Node.js include npm?
Yes. npm is included and can install project packages or run scripts defined by a project.
Can Node.js run JavaScript without a browser?
Yes. The node command executes JavaScript files on the computer, including server-side programs.
Can Node.js create a web server?
Yes. Its built-in http module can create a server that handles web requests.