Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.14 KB

nodejs-interactive-repl.md

File metadata and controls

54 lines (38 loc) · 2.14 KB
title description ms.date ms.topic ms.devlang author ms.author manager ms.technology dev_langs ms.workload
Use the Node.js REPL
Visual Studio provides support for interacting with the Node.js runtime
12/04/2018
how-to
javascript
mikejo5000
mikejo
jmartens
vs-javascript
JavaScript
nodejs

Work with the Node.js interactive window

[!INCLUDE Visual Studio]

Node.js Tools for Visual Studio include an interactive window for the installed Node.js runtime. This window allows you to enter JavaScript code and see the results immediately, as well as execute npm commands to interact with the current project. The interactive window is also known as a REPL (Read/Evaluate/Print Loop).

Open the interactive window

You can open the interactive window by right-clicking the Node.js project node in Solution Explorer and selecting Open Node.js Interactive Window.

Node.js interactive window in project context menu

The default short-cut keys to open the Node.js interactive window are [CTRL] + K, N. Or, you can open the window from the toolbar by choosing View > Windows > Node.js Interactive Window.

Use the REPL

Once opened, you can enter commands.

Node.js interactive window

The interactive window has several built-in commands, which start with a dot prefix to distinguish them from any JavaScript function that you declare. The following commands are supported:

.cls, .clear Clears the contents of the editor window, leaving the history and execution context intact.

.help Displays help on the specified command, or on all available commands and key bindings if none is specified.

.info Shows information about the current used Node.js executable.

.npm Runs an npm command. If the solution contains more than one project, specify the target project using .npm [projectname] <npm arguments>.

.reset Resets the execution environment to the initial state, keep history.

.save Saves the current REPL session to a file.