NODE_OPTIONS=options...
例如:
NODE_OPTIONS='--require "./my path/file.js"'# 检查器将在端口 5555 上可用
NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555NODE_OPTIONS='--require "./a.js"' node --require "./b.js"
# 相当于:
node --require "./a.js" --require "./b.js"允许的 Node.js 选项是:
--conditions--diagnostic-dir--disable-proto--enable-fips--enable-source-maps--experimental-import-meta-resolve--experimental-json-modules--experimental-loader--experimental-modules--experimental-policy--experimental-repl-await--experimental-specifier-resolution--experimental-vm-modules--experimental-wasi-unstable-preview1--experimental-wasm-modules--force-context-aware--force-fips--frozen-intrinsics--heapsnapshot-signal--http-parser--http-server-default-timeout--icu-data-dir--input-type--insecure-http-parser--inspect-brk--inspect-port、--debug-port--inspect-publish-uid--inspect--max-http-header-size--napi-modules--no-deprecation--no-force-async-hooks-checks--no-warnings--openssl-config--pending-deprecation--policy-integrity--preserve-symlinks-main--preserve-symlinks--prof-process--redirect-warnings--report-compact--report-dir、--report-directory--report-filename--report-on-fatalerror--report-on-signal--report-signal--report-uncaught-exception--require、-r--throw-deprecation--title--tls-cipher-list--tls-keylog--tls-max-v1.2--tls-max-v1.3--tls-min-v1.0--tls-min-v1.1--tls-min-v1.2--tls-min-v1.3--trace-deprecation--trace-event-categories--trace-event-file-pattern--trace-events-enabled--trace-exit--trace-sigint--trace-sync-io--trace-tls--trace-uncaught--trace-warnings--track-heap-objects--unhandled-rejections--use-bundled-ca--use-largepages--use-openssl-ca--v8-pool-size--zero-fill-buffers
允许的 V8 选项是:
--abort-on-uncaught-exception--disallow-code-generation-from-strings--huge-max-old-generation-size--interpreted-frames-native-stack--jitless--max-old-space-size--perf-basic-prof-only-functions--perf-basic-prof--perf-prof-unwinding-info--perf-prof--stack-trace-limit
--perf-basic-prof-only-functions、--perf-basic-prof、--perf-prof-unwinding-info 和 --perf-prof 仅在 Linux 上可用。
A space-separated list of command line options. options... are interpreted
before command line options, so command line options will override or
compound after anything in options.... Node.js will exit with an error if
an option that is not allowed in the environment is used, such as -p or a
script file.
In case an option value happens to contain a space (for example a path listed
in --require), it must be escaped using double quotes. For example:
NODE_OPTIONS='--require "./my path/file.js"'A singleton flag passed as a command line option will override the same flag
passed into NODE_OPTIONS:
# The inspector will be available on port 5555
NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555A flag that can be passed multiple times will be treated as if its
NODE_OPTIONS instances were passed first, and then its command line
instances afterwards:
NODE_OPTIONS='--require "./a.js"' node --require "./b.js"
# is equivalent to:
node --require "./a.js" --require "./b.js"Node.js options that are allowed are:
--conditions--diagnostic-dir--disable-proto--enable-fips--enable-source-maps--experimental-import-meta-resolve--experimental-json-modules--experimental-loader--experimental-modules--experimental-policy--experimental-repl-await--experimental-specifier-resolution--experimental-vm-modules--experimental-wasi-unstable-preview1--experimental-wasm-modules--force-context-aware--force-fips--frozen-intrinsics--heapsnapshot-signal--http-parser--http-server-default-timeout--icu-data-dir--input-type--insecure-http-parser--inspect-brk--inspect-port,--debug-port--inspect-publish-uid--inspect--max-http-header-size--napi-modules--no-deprecation--no-force-async-hooks-checks--no-warnings--openssl-config--pending-deprecation--policy-integrity--preserve-symlinks-main--preserve-symlinks--prof-process--redirect-warnings--report-compact--report-dir,--report-directory--report-filename--report-on-fatalerror--report-on-signal--report-signal--report-uncaught-exception--require,-r--throw-deprecation--title--tls-cipher-list--tls-keylog--tls-max-v1.2--tls-max-v1.3--tls-min-v1.0--tls-min-v1.1--tls-min-v1.2--tls-min-v1.3--trace-deprecation--trace-event-categories--trace-event-file-pattern--trace-events-enabled--trace-exit--trace-sigint--trace-sync-io--trace-tls--trace-uncaught--trace-warnings--track-heap-objects--unhandled-rejections--use-bundled-ca--use-largepages--use-openssl-ca--v8-pool-size--zero-fill-buffers
V8 options that are allowed are:
--abort-on-uncaught-exception--disallow-code-generation-from-strings--huge-max-old-generation-size--interpreted-frames-native-stack--jitless--max-old-space-size--perf-basic-prof-only-functions--perf-basic-prof--perf-prof-unwinding-info--perf-prof--stack-trace-limit
--perf-basic-prof-only-functions, --perf-basic-prof,
--perf-prof-unwinding-info, and --perf-prof are only available on Linux.