deno eval

Command line usage

deno eval [OPTIONS] [CODE_ARG]...

Evaluate JavaScript from the command line.

deno eval "console.log('hello world')"

To evaluate as TypeScript:

deno eval --ext=ts "const v: string = 'hello'; console.log(v)"

This command has implicit access to all permissions.


Type checking options

--check

Enable type-checking. This subcommand does not type-check by default If the value of "all" is supplied, remote modules will be included. Alternatively, the 'deno check' subcommand can be used.

--no-check

Skip type-checking. If the value of "remote" is supplied, diagnostic errors from remote modules will be ignored.

Dependency management options

--cached-only

Require that remote dependencies are already cached.

--frozen

Error out if lockfile is out of date.

--import-map

Load import map file from local file or remote URL.

--lock

Check the specified lock file. (If value is not provided, defaults to "./deno.lock").

--no-lock

Disable auto discovery of the lock file.

--no-npm

Do not resolve npm modules.

--no-remote

Do not resolve remote modules.

--node-modules-dir

Sets the node modules management mode for npm packages.

--reload

Short flag: -r

Reload source code cache (recompile TypeScript) no value Reload everything jsr:@std/http/file-server,jsr:@std/assert/assert-equals Reloads specific modules npm: Reload all npm modules npm:chalk Reload specific npm module.

--vendor

Toggles local vendor folder usage for remote modules and a node_modules folder for npm packages.

Options

--allow-scripts

Allow running npm lifecycle scripts for the given packages Note: Scripts will only be executed when using a node_modules directory (--node-modules-dir).

--cert

Load certificate authority from PEM encoded file.

--config

Short flag: -c

Configure different aspects of deno including TypeScript, linting, and code formatting Typically the configuration file will be called deno.json or deno.jsonc and automatically detected; in that case this flag is not necessary.

--env-file

Load environment variables from local file Only the first environment variable with a given key is used. Existing process environment variables are not overwritten, so if variables with the same names already exist in the environment, their values will be preserved. Where multiple declarations for the same environment variable exist in your .env file, the first one encountered is applied. This is determined by the order of the files you pass as arguments.

--ext

Set content type of the supplied file.

--location

Value of globalThis.location used by some web APIs.

--no-config

Disable automatic loading of the configuration file.

--print

Short flag: -p

print result to stdout.

--seed

Set the random number generator seed.

--v8-flags

To see a list of all available flags use --v8-flags=--help Flags can also be set via the DENO_V8_FLAGS environment variable. Any flags set with this flag are appended after the DENO_V8_FLAGS environment variable.

Debugging options

--inspect

Activate inspector on host:port [default: 127.0.0.1:9229]

--inspect-brk

Activate inspector on host:port, wait for debugger to connect and break at the start of user script.

--inspect-wait

Activate inspector on host:port and wait for debugger to connect before running user code.

© 2018–2024 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/runtime/reference/cli/eval