deno repl command starts an interactive Read-Eval-Print Loop for evaluating JavaScript and TypeScript code.
Usage
Description
The REPL provides an interactive environment to experiment with Deno, evaluate expressions, and test code snippets. It supports TypeScript, top-level await, and has built-in tab completion.Flags
Evaluate a file before entering the REPL. Can be specified multiple times
Evaluate code before entering the REPL
Load import map file
Do not resolve npm modules
Enables or disables the use of a local node_modules folder
Specify the configuration file
Disable automatic loading of the configuration file
Permission Flags
By default, when running justdeno (REPL as default command), all permissions are allowed. When explicitly running deno repl, you need to specify permissions:
Allow file system read access
Allow file system write access
Allow network access
Allow environment access
Allow running subprocesses
Allow all permissions
Features
TypeScript Support
The REPL natively supports TypeScript:Top-level Await
Useawait at the top level:
Tab Completion
Press Tab to autocomplete:Special Variables
_- Result of the last evaluated expression_error- Last thrown error
Multiline Input
Press Shift+Enter for multiline input:Examples
Basic REPL
Start the REPL with all permissions:REPL with specific permissions
Evaluate code on startup
Run code before entering the REPL:Load a file before REPL
Evaluate a file to set up the environment:Load multiple files
With import map
With configuration file
Keyboard Shortcuts
Ctrl+C- Exit (press twice) or cancel current inputCtrl+D- ExitTab- AutocompleteShift+Enter- Multiline inputUp/Down- Navigate command historyCtrl+R- Reverse search history
REPL History
Command history is saved in:- Unix:
~/.cache/deno/repl_history.txt - Windows:
%LOCALAPPDATA%/deno/repl_history.txt - macOS:
~/Library/Caches/deno/repl_history.txt