- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- Corepack 核心包
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- env 环境变量
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- module/typescript TS 模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
Node.js v22.22.0 文档
- Node.js v22.22.0
-
目录
- 错误
- 错误冒泡和拦截
- 类:
Error - 类:
AssertionError - 类:
RangeError - 类:
ReferenceError - 类:
SyntaxError - 类:
SystemError - 类:
TypeError - 异常与错误
- OpenSSL 错误
- Node.js 错误代码
ABORT_ERRERR_ACCESS_DENIEDERR_AMBIGUOUS_ARGUMENTERR_ARG_NOT_ITERABLEERR_ASSERTIONERR_ASYNC_CALLBACKERR_ASYNC_TYPEERR_BROTLI_COMPRESSION_FAILEDERR_BROTLI_INVALID_PARAMERR_BUFFER_CONTEXT_NOT_AVAILABLEERR_BUFFER_OUT_OF_BOUNDSERR_BUFFER_TOO_LARGEERR_CANNOT_WATCH_SIGINTERR_CHILD_CLOSED_BEFORE_REPLYERR_CHILD_PROCESS_IPC_REQUIREDERR_CHILD_PROCESS_STDIO_MAXBUFFERERR_CLOSED_MESSAGE_PORTERR_CONSOLE_WRITABLE_STREAMERR_CONSTRUCT_CALL_INVALIDERR_CONSTRUCT_CALL_REQUIREDERR_CONTEXT_NOT_INITIALIZEDERR_CPU_PROFILE_ALREADY_STARTEDERR_CPU_PROFILE_NOT_STARTEDERR_CPU_PROFILE_TOO_MANYERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTEDERR_CRYPTO_ECDH_INVALID_FORMATERR_CRYPTO_ECDH_INVALID_PUBLIC_KEYERR_CRYPTO_ENGINE_UNKNOWNERR_CRYPTO_FIPS_FORCEDERR_CRYPTO_FIPS_UNAVAILABLEERR_CRYPTO_HASH_FINALIZEDERR_CRYPTO_HASH_UPDATE_FAILEDERR_CRYPTO_INCOMPATIBLE_KEYERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONSERR_CRYPTO_INITIALIZATION_FAILEDERR_CRYPTO_INVALID_AUTH_TAGERR_CRYPTO_INVALID_COUNTERERR_CRYPTO_INVALID_CURVEERR_CRYPTO_INVALID_DIGESTERR_CRYPTO_INVALID_IVERR_CRYPTO_INVALID_JWKERR_CRYPTO_INVALID_KEYLENERR_CRYPTO_INVALID_KEYPAIRERR_CRYPTO_INVALID_KEYTYPEERR_CRYPTO_INVALID_KEY_OBJECT_TYPEERR_CRYPTO_INVALID_MESSAGELENERR_CRYPTO_INVALID_SCRYPT_PARAMSERR_CRYPTO_INVALID_STATEERR_CRYPTO_INVALID_TAG_LENGTHERR_CRYPTO_JOB_INIT_FAILEDERR_CRYPTO_JWK_UNSUPPORTED_CURVEERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPEERR_CRYPTO_OPERATION_FAILEDERR_CRYPTO_PBKDF2_ERRORERR_CRYPTO_SCRYPT_INVALID_PARAMETERERR_CRYPTO_SCRYPT_NOT_SUPPORTEDERR_CRYPTO_SIGN_KEY_REQUIREDERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTHERR_CRYPTO_UNKNOWN_CIPHERERR_CRYPTO_UNKNOWN_DH_GROUPERR_CRYPTO_UNSUPPORTED_OPERATIONERR_DEBUGGER_ERRORERR_DEBUGGER_STARTUP_ERRORERR_DIR_CLOSEDERR_DIR_CONCURRENT_OPERATIONERR_DLOPEN_DISABLEDERR_DLOPEN_FAILEDERR_DNS_SET_SERVERS_FAILEDERR_DOMAIN_CALLBACK_NOT_AVAILABLEERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTUREERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTIONERR_ENCODING_INVALID_ENCODED_DATAERR_ENCODING_NOT_SUPPORTEDERR_EVAL_ESM_CANNOT_PRINTERR_EVENT_RECURSIONERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLEERR_FALSY_VALUE_REJECTIONERR_FEATURE_UNAVAILABLE_ON_PLATFORMERR_FS_CP_DIR_TO_NON_DIRERR_FS_CP_EEXISTERR_FS_CP_EINVALERR_FS_CP_FIFO_PIPEERR_FS_CP_NON_DIR_TO_DIRERR_FS_CP_SOCKETERR_FS_CP_SYMLINK_TO_SUBDIRECTORYERR_FS_CP_UNKNOWNERR_FS_EISDIRERR_FS_FILE_TOO_LARGEERR_FS_INVALID_SYMLINK_TYPEERR_FS_WATCH_QUEUE_OVERFLOWERR_HTTP2_ALTSVC_INVALID_ORIGINERR_HTTP2_ALTSVC_LENGTHERR_HTTP2_CONNECT_AUTHORITYERR_HTTP2_CONNECT_PATHERR_HTTP2_CONNECT_SCHEMEERR_HTTP2_ERRORERR_HTTP2_GOAWAY_SESSIONERR_HTTP2_HEADERS_AFTER_RESPONDERR_HTTP2_HEADERS_SENTERR_HTTP2_HEADER_SINGLE_VALUEERR_HTTP2_INFO_STATUS_NOT_ALLOWEDERR_HTTP2_INVALID_CONNECTION_HEADERSERR_HTTP2_INVALID_HEADER_VALUEERR_HTTP2_INVALID_INFO_STATUSERR_HTTP2_INVALID_ORIGINERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTHERR_HTTP2_INVALID_PSEUDOHEADERERR_HTTP2_INVALID_SESSIONERR_HTTP2_INVALID_SETTING_VALUEERR_HTTP2_INVALID_STREAMERR_HTTP2_MAX_PENDING_SETTINGS_ACKERR_HTTP2_NESTED_PUSHERR_HTTP2_NO_MEMERR_HTTP2_NO_SOCKET_MANIPULATIONERR_HTTP2_ORIGIN_LENGTHERR_HTTP2_OUT_OF_STREAMSERR_HTTP2_PAYLOAD_FORBIDDENERR_HTTP2_PING_CANCELERR_HTTP2_PING_LENGTHERR_HTTP2_PSEUDOHEADER_NOT_ALLOWEDERR_HTTP2_PUSH_DISABLEDERR_HTTP2_SEND_FILEERR_HTTP2_SEND_FILE_NOSEEKERR_HTTP2_SESSION_ERRORERR_HTTP2_SETTINGS_CANCELERR_HTTP2_SOCKET_BOUNDERR_HTTP2_SOCKET_UNBOUNDERR_HTTP2_STATUS_101ERR_HTTP2_STATUS_INVALIDERR_HTTP2_STREAM_CANCELERR_HTTP2_STREAM_ERRORERR_HTTP2_STREAM_SELF_DEPENDENCYERR_HTTP2_TOO_MANY_CUSTOM_SETTINGSERR_HTTP2_TOO_MANY_INVALID_FRAMESERR_HTTP2_TRAILERS_ALREADY_SENTERR_HTTP2_TRAILERS_NOT_READYERR_HTTP2_UNSUPPORTED_PROTOCOLERR_HTTP_BODY_NOT_ALLOWEDERR_HTTP_CONTENT_LENGTH_MISMATCHERR_HTTP_HEADERS_SENTERR_HTTP_INVALID_HEADER_VALUEERR_HTTP_INVALID_STATUS_CODEERR_HTTP_REQUEST_TIMEOUTERR_HTTP_SOCKET_ASSIGNEDERR_HTTP_SOCKET_ENCODINGERR_HTTP_TRAILER_INVALIDERR_ILLEGAL_CONSTRUCTORERR_IMPORT_ATTRIBUTE_MISSINGERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLEERR_IMPORT_ATTRIBUTE_UNSUPPORTEDERR_INCOMPATIBLE_OPTION_PAIRERR_INPUT_TYPE_NOT_ALLOWEDERR_INSPECTOR_ALREADY_ACTIVATEDERR_INSPECTOR_ALREADY_CONNECTEDERR_INSPECTOR_CLOSEDERR_INSPECTOR_COMMANDERR_INSPECTOR_NOT_ACTIVEERR_INSPECTOR_NOT_AVAILABLEERR_INSPECTOR_NOT_CONNECTEDERR_INSPECTOR_NOT_WORKERERR_INTERNAL_ASSERTIONERR_INVALID_ADDRESSERR_INVALID_ADDRESS_FAMILYERR_INVALID_ARG_TYPEERR_INVALID_ARG_VALUEERR_INVALID_ASYNC_IDERR_INVALID_BUFFER_SIZEERR_INVALID_CHARERR_INVALID_CURSOR_POSERR_INVALID_FDERR_INVALID_FD_TYPEERR_INVALID_FILE_URL_HOSTERR_INVALID_FILE_URL_PATHERR_INVALID_HANDLE_TYPEERR_INVALID_HTTP_TOKENERR_INVALID_IP_ADDRESSERR_INVALID_MIME_SYNTAXERR_INVALID_MODULEERR_INVALID_MODULE_SPECIFIERERR_INVALID_OBJECT_DEFINE_PROPERTYERR_INVALID_PACKAGE_CONFIGERR_INVALID_PACKAGE_TARGETERR_INVALID_PROTOCOLERR_INVALID_REPL_EVAL_CONFIGERR_INVALID_REPL_INPUTERR_INVALID_RETURN_PROPERTYERR_INVALID_RETURN_PROPERTY_VALUEERR_INVALID_RETURN_VALUEERR_INVALID_STATEERR_INVALID_SYNC_FORK_INPUTERR_INVALID_THISERR_INVALID_TUPLEERR_INVALID_TYPESCRIPT_SYNTAXERR_INVALID_URIERR_INVALID_URLERR_INVALID_URL_SCHEMEERR_IPC_CHANNEL_CLOSEDERR_IPC_DISCONNECTEDERR_IPC_ONE_PIPEERR_IPC_SYNC_FORKERR_IP_BLOCKEDERR_LOADER_CHAIN_INCOMPLETEERR_LOAD_SQLITE_EXTENSIONERR_MEMORY_ALLOCATION_FAILEDERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLEERR_METHOD_NOT_IMPLEMENTEDERR_MISSING_ARGSERR_MISSING_OPTIONERR_MISSING_PASSPHRASEERR_MISSING_PLATFORM_FOR_WORKERERR_MODULE_LINK_MISMATCHERR_MODULE_NOT_FOUNDERR_MULTIPLE_CALLBACKERR_NAPI_CONS_FUNCTIONERR_NAPI_INVALID_DATAVIEW_ARGSERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENTERR_NAPI_INVALID_TYPEDARRAY_LENGTHERR_NAPI_TSFN_CALL_JSERR_NAPI_TSFN_GET_UNDEFINEDERR_NON_CONTEXT_AWARE_DISABLEDERR_NOT_BUILDING_SNAPSHOTERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATIONERR_NOT_SUPPORTED_IN_SNAPSHOTERR_NO_CRYPTOERR_NO_ICUERR_NO_TYPESCRIPTERR_OPERATION_FAILEDERR_OPTIONS_BEFORE_BOOTSTRAPPINGERR_OUT_OF_RANGEERR_PACKAGE_IMPORT_NOT_DEFINEDERR_PACKAGE_PATH_NOT_EXPORTEDERR_PARSE_ARGS_INVALID_OPTION_VALUEERR_PARSE_ARGS_UNEXPECTED_POSITIONALERR_PARSE_ARGS_UNKNOWN_OPTIONERR_PERFORMANCE_INVALID_TIMESTAMPERR_PERFORMANCE_MEASURE_INVALID_OPTIONSERR_PROTO_ACCESSERR_PROXY_INVALID_CONFIGERR_PROXY_TUNNELERR_QUIC_APPLICATION_ERRORERR_QUIC_CONNECTION_FAILEDERR_QUIC_ENDPOINT_CLOSEDERR_QUIC_OPEN_STREAM_FAILEDERR_QUIC_TRANSPORT_ERRORERR_QUIC_VERSION_NEGOTIATION_ERRORERR_REQUIRE_ASYNC_MODULEERR_REQUIRE_CYCLE_MODULEERR_REQUIRE_ESMERR_SCRIPT_EXECUTION_INTERRUPTEDERR_SCRIPT_EXECUTION_TIMEOUTERR_SERVER_ALREADY_LISTENERR_SERVER_NOT_RUNNINGERR_SINGLE_EXECUTABLE_APPLICATION_ASSET_NOT_FOUNDERR_SOCKET_ALREADY_BOUNDERR_SOCKET_BAD_BUFFER_SIZEERR_SOCKET_BAD_PORTERR_SOCKET_BAD_TYPEERR_SOCKET_BUFFER_SIZEERR_SOCKET_CLOSEDERR_SOCKET_CLOSED_BEFORE_CONNECTIONERR_SOCKET_CONNECTION_TIMEOUTERR_SOCKET_DGRAM_IS_CONNECTEDERR_SOCKET_DGRAM_NOT_CONNECTEDERR_SOCKET_DGRAM_NOT_RUNNINGERR_SOURCE_MAP_CORRUPTERR_SOURCE_MAP_MISSING_SOURCEERR_SQLITE_ERRORERR_SRI_PARSEERR_STREAM_ALREADY_FINISHEDERR_STREAM_CANNOT_PIPEERR_STREAM_DESTROYEDERR_STREAM_NULL_VALUESERR_STREAM_PREMATURE_CLOSEERR_STREAM_PUSH_AFTER_EOFERR_STREAM_UNSHIFT_AFTER_END_EVENTERR_STREAM_WRAPERR_STREAM_WRITE_AFTER_ENDERR_STRING_TOO_LONGERR_SYNTHETICERR_SYSTEM_ERRORERR_TEST_FAILUREERR_TLS_ALPN_CALLBACK_INVALID_RESULTERR_TLS_ALPN_CALLBACK_WITH_PROTOCOLSERR_TLS_CERT_ALTNAME_FORMATERR_TLS_CERT_ALTNAME_INVALIDERR_TLS_DH_PARAM_SIZEERR_TLS_HANDSHAKE_TIMEOUTERR_TLS_INVALID_CONTEXTERR_TLS_INVALID_PROTOCOL_METHODERR_TLS_INVALID_PROTOCOL_VERSIONERR_TLS_INVALID_STATEERR_TLS_PROTOCOL_VERSION_CONFLICTERR_TLS_PSK_SET_IDENTIY_HINT_FAILEDERR_TLS_RENEGOTIATION_DISABLEDERR_TLS_REQUIRED_SERVER_NAMEERR_TLS_SESSION_ATTACKERR_TLS_SNI_FROM_SERVERERR_TRACE_EVENTS_CATEGORY_REQUIREDERR_TRACE_EVENTS_UNAVAILABLEERR_TRAILING_JUNK_AFTER_STREAM_ENDERR_TRANSFORM_ALREADY_TRANSFORMINGERR_TRANSFORM_WITH_LENGTH_0ERR_TTY_INIT_FAILEDERR_UNAVAILABLE_DURING_EXITERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SETERR_UNESCAPED_CHARACTERSERR_UNHANDLED_ERRORERR_UNKNOWN_BUILTIN_MODULEERR_UNKNOWN_CREDENTIALERR_UNKNOWN_ENCODINGERR_UNKNOWN_FILE_EXTENSIONERR_UNKNOWN_MODULE_FORMATERR_UNKNOWN_SIGNALERR_UNSUPPORTED_DIR_IMPORTERR_UNSUPPORTED_ESM_URL_SCHEMEERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPINGERR_UNSUPPORTED_RESOLVE_REQUESTERR_UNSUPPORTED_TYPESCRIPT_SYNTAXERR_USE_AFTER_CLOSEERR_VALID_PERFORMANCE_ENTRY_TYPEERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSINGERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAGERR_VM_MODULE_ALREADY_LINKEDERR_VM_MODULE_CACHED_DATA_REJECTEDERR_VM_MODULE_CANNOT_CREATE_CACHED_DATAERR_VM_MODULE_DIFFERENT_CONTEXTERR_VM_MODULE_LINK_FAILUREERR_VM_MODULE_NOT_MODULEERR_VM_MODULE_STATUSERR_WASI_ALREADY_STARTEDERR_WASI_NOT_STARTEDERR_WEBASSEMBLY_RESPONSEERR_WORKER_INIT_FAILEDERR_WORKER_INVALID_EXEC_ARGVERR_WORKER_MESSAGING_ERROREDERR_WORKER_MESSAGING_FAILEDERR_WORKER_MESSAGING_SAME_THREADERR_WORKER_MESSAGING_TIMEOUTERR_WORKER_NOT_RUNNINGERR_WORKER_OUT_OF_MEMORYERR_WORKER_PATHERR_WORKER_UNSERIALIZABLE_ERRORERR_WORKER_UNSUPPORTED_OPERATIONERR_ZLIB_INITIALIZATION_FAILEDERR_ZSTD_INVALID_PARAMHPE_CHUNK_EXTENSIONS_OVERFLOWHPE_HEADER_OVERFLOWHPE_UNEXPECTED_CONTENT_LENGTHMODULE_NOT_FOUND
- 旧版 Node.js 错误代码
ERR_CANNOT_TRANSFER_OBJECTERR_CPU_USAGEERR_CRYPTO_HASH_DIGEST_NO_UTF16ERR_HTTP2_FRAME_ERRORERR_HTTP2_HEADERS_OBJECTERR_HTTP2_HEADER_REQUIREDERR_HTTP2_INFO_HEADERS_AFTER_RESPONDERR_HTTP2_STREAM_CLOSEDERR_HTTP_INVALID_CHARERR_IMPORT_ASSERTION_TYPE_FAILEDERR_IMPORT_ASSERTION_TYPE_MISSINGERR_IMPORT_ASSERTION_TYPE_UNSUPPORTEDERR_INDEX_OUT_OF_RANGEERR_INVALID_OPT_VALUEERR_INVALID_OPT_VALUE_ENCODINGERR_INVALID_PERFORMANCE_MARKERR_INVALID_TRANSFER_OBJECTERR_MANIFEST_ASSERT_INTEGRITYERR_MANIFEST_DEPENDENCY_MISSINGERR_MANIFEST_INTEGRITY_MISMATCHERR_MANIFEST_INVALID_RESOURCE_FIELDERR_MANIFEST_INVALID_SPECIFIERERR_MANIFEST_PARSE_POLICYERR_MANIFEST_TDZERR_MANIFEST_UNKNOWN_ONERRORERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LISTERR_MISSING_TRANSFERABLE_IN_TRANSFER_LISTERR_NAPI_CONS_PROTOTYPE_OBJECTERR_NAPI_TSFN_START_IDLE_LOOPERR_NAPI_TSFN_STOP_IDLE_LOOPERR_NO_LONGER_SUPPORTEDERR_OUTOFMEMORYERR_PARSE_HISTORY_DATAERR_SOCKET_CANNOT_SENDERR_STDERR_CLOSEERR_STDOUT_CLOSEERR_STREAM_READ_NOT_IMPLEMENTEDERR_TAP_LEXER_ERRORERR_TAP_PARSER_ERRORERR_TAP_VALIDATION_ERRORERR_TLS_RENEGOTIATION_FAILEDERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFERERR_UNKNOWN_STDIN_TYPEERR_UNKNOWN_STREAM_TYPEERR_V8BREAKITERATORERR_VALUE_OUT_OF_RANGEERR_VM_MODULE_LINKING_ERROREDERR_VM_MODULE_NOT_LINKEDERR_WORKER_UNSUPPORTED_EXTENSIONERR_ZLIB_BINDING_CLOSED
- OpenSSL 错误代码
- 错误
-
导航
- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- Corepack 核心包
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- env 环境变量
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- module/typescript TS 模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
- 其他版本
错误#>
【Errors】
在 Node.js 中运行的应用通常会遇到以下几类错误:
【Applications running in Node.js will generally experience the following categories of errors:】
- 标准的 JavaScript 错误,例如 <EvalError>、<SyntaxError>、<RangeError>、<ReferenceError>、<TypeError> 和 <URIError>。
- 标准
DOMException。 - 由底层操作系统限制引发的系统错误,例如尝试打开不存在的文件或尝试通过已关闭的套接字发送数据。
AssertionError是一种特殊类型的错误,当 Node.js 检测到不应该发生的异常逻辑违规时,会触发这种错误。这类错误通常由node:assert模块引发。- 由应用代码触发的用户指定错误。
由 Node.js 引发的所有 JavaScript 和系统错误都继承自标准 JavaScript <Error> 类,或者是该类的实例,并且保证至少提供该类上的属性。
【All JavaScript and system errors raised by Node.js inherit from, or are instances of, the standard JavaScript <Error> class and are guaranteed to provide at least the properties available on that class.】
Node.js 抛出的错误的 error.message 属性可能在任何版本中发生变化。请改用 error.code 来识别错误。对于 DOMException,使用 domException.name 来识别其类型。
【The error.message property of errors raised by Node.js may be changed in
any versions. Use error.code to identify an error instead. For a
DOMException, use domException.name to identify its type.】
错误冒泡和拦截#>
【Error propagation and interception】
Node.js 支持多种机制来传播和处理应用运行时发生的错误。这些错误的报告和处理方式完全取决于 Error 的类型以及调用的 API 风格。
【Node.js supports several mechanisms for propagating and handling errors that
occur while an application is running. How these errors are reported and
handled depends entirely on the type of Error and the style of the API that is
called.】
所有 JavaScript 错误都被作为异常处理,它们会_立即_生成并使用标准的 JavaScript throw 机制抛出错误。这些错误是通过 JavaScript 语言提供的 try…catch 结构 处理的。
【All JavaScript errors are handled as exceptions that immediately generate
and throw an error using the standard JavaScript throw mechanism. These
are handled using the try…catch construct provided by the
JavaScript language.】
// Throws with a ReferenceError because z is not defined.
try {
const m = 1;
const n = m + z;
} catch (err) {
// Handle the error here.
}
任何使用 JavaScript throw 机制的操作都会引发异常,这个异常必须被处理,否则 Node.js 进程将立即退出。
【Any use of the JavaScript throw mechanism will raise an exception that
must be handled or the Node.js process will exit immediately.】
除少数例外外,同步 API(任何不返回 <Promise> 也不接受 callback 函数的阻塞方法,例如 fs.readFileSync)将使用 throw 来报告错误。
【With few exceptions, Synchronous APIs (any blocking method that does not
return a <Promise> nor accept a callback function, such as
fs.readFileSync), will use throw to report errors.】
异步 API 中发生的错误可能会以多种方式报告:
【Errors that occur within Asynchronous APIs may be reported in multiple ways:】
-
有些异步方法会返回一个 <Promise>,你应该始终考虑到它可能会被拒绝。请参阅
--unhandled-rejections标志,了解在未处理的 promise 拒绝时该过程将如何反应。const fs = require('node:fs/promises'); (async () => { let data; try { data = await fs.readFile('a file that does not exist'); } catch (err) { console.error('There was an error reading the file!', err); return; } // Otherwise handle the data })(); -
大多数接受
callback函数的异步方法会将一个Error对象作为该函数的第一个参数传入。如果第一个参数不为null且是Error的实例,那么就发生了错误,需要进行处理。const fs = require('node:fs'); fs.readFile('a file that does not exist', (err, data) => { if (err) { console.error('There was an error reading the file!', err); return; } // Otherwise handle the data }); -
当在一个是
EventEmitter的对象上调用异步方法时,错误可以被传递到该对象的'error'事件。const net = require('node:net'); const connection = net.connect('localhost'); // Adding an 'error' event handler to a stream: connection.on('error', (err) => { // If the connection is reset by the server, or if it can't // connect at all, or on any sort of error encountered by // the connection, the error will be sent here. console.error(err); }); connection.pipe(process.stdout); -
在 Node.js API 中,一些典型的异步方法仍然可能使用
throw机制来抛出异常,这些异常必须使用try…catch来处理。没有关于这些方法的完整列表;请参考每个方法的文档以确定所需的适当错误处理机制。
对于 基于流的 和 基于事件触发器的 API,使用 'error' 事件机制是最常见的,它们本身代表了一系列随时间进行的异步操作(与可能成功或失败的单一操作相对)。
【The use of the 'error' event mechanism is most common for stream-based
and event emitter-based APIs, which themselves represent a series of
asynchronous operations over time (as opposed to a single operation that may
pass or fail).】
对于 所有 EventEmitter 对象,如果没有提供 'error' 事件处理程序,错误将会被抛出,导致 Node.js 进程报告未捕获的异常并崩溃,除非:已经为 'uncaughtException' 事件注册了处理程序,或者使用了已弃用的 node:domain 模块。
【For all EventEmitter objects, if an 'error' event handler is not
provided, the error will be thrown, causing the Node.js process to report an
uncaught exception and crash unless either: a handler has been registered for
the 'uncaughtException' event, or the deprecated node:domain
module is used.】
const EventEmitter = require('node:events');
const ee = new EventEmitter();
setImmediate(() => {
// This will crash the process because no 'error' event
// handler has been added.
ee.emit('error', new Error('This will crash'));
});
以这种方式生成的错误无法使用 try…catch 拦截,因为它们是在调用代码已经退出之后抛出的。
【Errors generated in this way cannot be intercepted using try…catch as
they are thrown after the calling code has already exited.】
开发者必须查阅每种方法的文档,以确定这些方法引发的错误是如何传播的。
【Developers must refer to the documentation for each method to determine exactly how errors raised by those methods are propagated.】
类:Error#>
【Class: Error】
一个通用的 JavaScript <Error> 对象,不表示错误发生的任何具体情况。Error 对象会捕获一个“堆栈跟踪”,详细说明 Error 被实例化时代码的位置,并且可能提供错误的文本描述。
【A generic JavaScript <Error> object that does not denote any specific
circumstance of why the error occurred. Error objects capture a "stack trace"
detailing the point in the code at which the Error was instantiated, and may
provide a text description of the error.】
Node.js 生成的所有错误,包括所有系统错误和 JavaScript 错误,要么是 Error 类的实例,要么继承自 Error 类。
【All errors generated by Node.js, including all system and JavaScript errors,
will either be instances of, or inherit from, the Error class.】
new Error(message[, options])#>
创建一个新的 Error 对象,并将 error.message 属性设置为提供的文本消息。如果传入的 message 是一个对象,则通过调用 String(message) 生成文本消息。如果提供了 cause 选项,它将被分配给 error.cause 属性。error.stack 属性将表示调用 new Error() 时代码中的位置。堆栈跟踪依赖于 V8 的堆栈跟踪 API。堆栈跟踪只扩展到 (a) 同步代码执行 的开始,或 (b) 属性 Error.stackTraceLimit 指定的帧数,以较小者为准。
【Creates a new Error object and sets the error.message property to the
provided text message. If an object is passed as message, the text message
is generated by calling String(message). If the cause option is provided,
it is assigned to the error.cause property. The error.stack property will
represent the point in the code at which new Error() was called. Stack traces
are dependent on V8's stack trace API. Stack traces extend only to either
(a) the beginning of synchronous code execution, or (b) the number of frames
given by the property Error.stackTraceLimit, whichever is smaller.】
Error.captureStackTrace(targetObject[, constructorOpt])#>
targetObject<Object>constructorOpt<Function>
在 targetObject 上创建一个 .stack 属性,当访问它时,会返回一个字符串,表示调用 Error.captureStackTrace() 时代码的位置。
【Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.】
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
跟踪的第一行将以 ${myObject.name}: ${myObject.message} 为前缀。
【The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.】
可选的 constructorOpt 参数接受一个函数。如果提供,所有位于 constructorOpt 之上的堆栈帧(包括 constructorOpt 本身)将在生成的堆栈跟踪中被省略。
【The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.】
constructorOpt 参数对于向用户隐藏错误生成的实现细节非常有用。例如:
【The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:】
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Error.stackTraceLimit#>
- 类型:<number>
Error.stackTraceLimit 属性指定堆栈跟踪收集的堆栈帧数量(无论是由 new Error().stack 生成,还是由 Error.captureStackTrace(obj) 生成)。
【The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).】
默认值是 10,但可以设置为任何有效的 JavaScript 数字。更改后会影响所有在值更改后捕获的堆栈跟踪。
【The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.】
如果设置为非数字值,或设置为负数,堆栈跟踪将不会捕获任何帧。
【If set to a non-number value, or set to a negative number, stack traces will not capture any frames.】
error.cause#>
- 类型:<any>
如果存在,error.cause 属性是 Error 的根本原因。 当捕获一个错误并抛出一个带有不同信息或代码的新错误时,它用于仍然能够访问原始错误。
【If present, the error.cause property is the underlying cause of the Error.
It is used when catching an error and throwing a new one with a different
message or code in order to still have access to the original error.】
error.cause 属性通常通过调用 new Error(message, { cause }) 设置。如果未提供 cause 选项,构造函数不会设置该属性。
【The error.cause property is typically set by calling
new Error(message, { cause }). It is not set by the constructor if the
cause option is not provided.】
此属性允许将错误进行链式处理。在序列化 Error 对象时,如果设置了 error.cause,util.inspect() 会递归地序列化它。
【This property allows errors to be chained. When serializing Error objects,
util.inspect() recursively serializes error.cause if it is set.】
const cause = new Error('The remote HTTP server responded with a 500 status');
const symptom = new Error('The message failed to send', { cause });
console.log(symptom);
// Prints:
// Error: The message failed to send
// at REPL2:1:17
// at Script.runInThisContext (node:vm:130:12)
// ... 7 lines matching cause stack trace ...
// at [_line] [as _line] (node:internal/readline/interface:886:18) {
// [cause]: Error: The remote HTTP server responded with a 500 status
// at REPL1:1:15
// at Script.runInThisContext (node:vm:130:12)
// at REPLServer.defaultEval (node:repl:574:29)
// at bound (node:domain:426:15)
// at REPLServer.runBound [as eval] (node:domain:437:12)
// at REPLServer.onLine (node:repl:902:10)
// at REPLServer.emit (node:events:549:35)
// at REPLServer.emit (node:domain:482:12)
// at [_onLine] [as _onLine] (node:internal/readline/interface:425:12)
// at [_line] [as _line] (node:internal/readline/interface:886:18)
error.code#>
- 类型:<string>
error.code 属性是一个字符串标签,用于标识错误类型。error.code 是识别错误最稳定的方法。它仅会在 Node.js 的主要版本之间发生变化。相比之下,error.message 字符串可能会在任何版本的 Node.js 之间发生变化。有关特定代码的详细信息,请参见 Node.js 错误代码。
【The error.code property is a string label that identifies the kind of error.
error.code is the most stable way to identify an error. It will only change
between major versions of Node.js. In contrast, error.message strings may
change between any versions of Node.js. See Node.js error codes for details
about specific codes.】
error.message#>
- 类型:<string>
error.message 属性是错误的字符串描述,由调用 new Error(message) 设置。传递给构造函数的 message 也会出现在 Error 的堆栈跟踪的第一行,然而在 Error 对象创建之后更改此属性 可能不会 改变堆栈跟踪的第一行(例如,当在更改此属性之前读取 error.stack 时)。
【The error.message property is the string description of the error as set by
calling new Error(message). The message passed to the constructor will also
appear in the first line of the stack trace of the Error, however changing
this property after the Error object is created may not change the first
line of the stack trace (for example, when error.stack is read before this
property is changed).】
const err = new Error('The message');
console.error(err.message);
// Prints: The message
error.stack#>
- 类型:<string>
error.stack 属性是一个字符串,用于描述 Error 被实例化时代码中的位置。
【The error.stack property is a string describing the point in the code at which
the Error was instantiated.】
Error: Things keep happening!
at /home/gbusey/file.js:525:2
at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)
at Actor.<anonymous> (/home/gbusey/actors.js:400:8)
at increaseSynergy (/home/gbusey/actors.js:701:6)
第一行的格式为 <error class name>: <error message>,紧接着是一系列堆栈帧(每行以“at ”开头)。每个堆栈帧描述了代码中导致错误生成的调用位置。V8 尝试为每个函数显示名称(通过变量名、函数名或对象方法名),但有时可能找不到合适的名称。如果 V8 无法确定函数名称,该堆栈帧只会显示位置信息。否则,将显示确定的函数名称,并在括号中附加位置信息。
【The first line is formatted as <error class name>: <error message>, and
is followed by a series of stack frames (each line beginning with "at ").
Each frame describes a call site within the code that lead to the error being
generated. V8 attempts to display a name for each function (by variable name,
function name, or object method name), but occasionally it will not be able to
find a suitable name. If V8 cannot determine a name for the function, only
location information will be displayed for that frame. Otherwise, the
determined function name will be displayed with location information appended
in parentheses.】
只有 JavaScript 函数才会生成帧。例如,如果执行同步地通过一个名为 cheetahify 的 C++ 插件函数,而该函数本身又调用了一个 JavaScript 函数,那么表示 cheetahify 调用的帧将不会出现在堆栈跟踪中:
【Frames are only generated for JavaScript functions. If, for example, execution
synchronously passes through a C++ addon function called cheetahify which
itself calls a JavaScript function, the frame representing the cheetahify call
will not be present in the stack traces:】
const cheetahify = require('./native-binding.node');
function makeFaster() {
// `cheetahify()` *synchronously* calls speedy.
cheetahify(function speedy() {
throw new Error('oh no!');
});
}
makeFaster();
// will throw:
// /home/gbusey/file.js:6
// throw new Error('oh no!');
// ^
// Error: oh no!
// at speedy (/home/gbusey/file.js:6:11)
// at makeFaster (/home/gbusey/file.js:5:3)
// at Object.<anonymous> (/home/gbusey/file.js:10:1)
// at Module._compile (module.js:456:26)
// at Object.Module._extensions..js (module.js:474:10)
// at Module.load (module.js:356:32)
// at Function.Module._load (module.js:312:12)
// at Function.Module.runMain (module.js:497:10)
// at startup (node.js:119:16)
// at node.js:906:3
位置信息将是以下之一:
【The location information will be one of:】
native,如果该帧表示 V8 内部的调用(如[].forEach)。plain-filename.js:行号:列号,如果该堆栈帧表示对 Node.js 内部的调用。/absolute/path/to/file.js:行:列,如果该帧表示用户程序(使用 CommonJS 模块系统)或其依赖中的调用。<transport-protocol>:///url/to/module/file.mjs:line:column,如果该堆栈帧表示用户程序中的调用(使用 ES 模块系统),或者其依赖。
表示堆栈跟踪的字符串是在访问 error.stack 属性时懒惰生成的。
【The string representing the stack trace is lazily generated when the
error.stack property is accessed.】
堆栈跟踪捕获的帧数受 Error.stackTraceLimit 与当前事件循环滴答上可用帧数较小者的限制。
【The number of frames captured by the stack trace is bounded by the smaller of
Error.stackTraceLimit or the number of available frames on the current event
loop tick.】
类:AssertionError#>
【Class: AssertionError】
表示断言失败。详情请参见 Class: assert.AssertionError。
【Indicates the failure of an assertion. For details, see
Class: assert.AssertionError.】
类:RangeError#>
【Class: RangeError】
表示提供的参数不在函数可接受值的集合或范围内;无论是数值范围,还是超出了给定函数参数的选项集合。
【Indicates that a provided argument was not within the set or range of acceptable values for a function; whether that is a numeric range, or outside the set of options for a given function parameter.】
require('node:net').connect(-1);
// Throws "RangeError: "port" option should be >= 0 and < 65536: -1"
Node.js 会立即生成并抛出 RangeError 实例,作为一种参数验证形式。
【Node.js will generate and throw RangeError instances immediately as a form
of argument validation.】
类:ReferenceError#>
【Class: ReferenceError】
表示正在尝试访问一个未定义的变量。这类错误通常表示代码中有拼写错误,或者程序本身存在其他问题。
【Indicates that an attempt is being made to access a variable that is not defined. Such errors commonly indicate typos in code, or an otherwise broken program.】
虽然客户端代码可能会生成并传播这些错误,但在实际操作中,只有 V8 会这样做。
【While client code may generate and propagate these errors, in practice, only V8 will do so.】
doesNotExist;
// Throws ReferenceError, doesNotExist is not a variable in this program.
除非应用正在动态生成和运行代码,否则 ReferenceError 实例表示代码或其依赖中存在错误。
【Unless an application is dynamically generating and running code,
ReferenceError instances indicate a bug in the code or its dependencies.】
类:SyntaxError#>
【Class: SyntaxError】
表示程序不是有效的 JavaScript。这些错误可能仅作为代码评估的结果被产生和传播。代码评估可能由于使用 eval、Function、require 或 虚拟机 而发生。这些错误几乎总是表明程序出现了问题。
【Indicates that a program is not valid JavaScript. These errors may only be
generated and propagated as a result of code evaluation. Code evaluation may
happen as a result of eval, Function, require, or vm. These errors
are almost always indicative of a broken program.】
try {
require('node:vm').runInThisContext('binary ! isNotOk');
} catch (err) {
// 'err' will be a SyntaxError.
}
SyntaxError 实例在创建它们的上下文中是无法恢复的——它们只能被其他上下文捕获。
类:SystemError#>
【Class: SystemError】
当 Node.js 在其运行环境中发生异常时,会生成系统错误。这些错误通常发生在应用违反操作系统约束时。例如,如果应用尝试读取不存在的文件,就会发生系统错误。
【Node.js generates system errors when exceptions occur within its runtime environment. These usually occur when an application violates an operating system constraint. For example, a system error will occur if an application attempts to read a file that does not exist.】
address<string> 如果存在,表示网络连接失败的地址code<string> 字符串错误代码dest<string> 如果存在,在报告文件系统错误时的文件路径目的地errno<number> 系统提供的错误编号info<Object> 如果存在,关于错误情况的额外详细信息message<string> 系统提供的可供人类阅读的错误描述path<string> 如果存在,在报告文件系统错误时的文件路径port<number> 如果存在,不可用的网络连接端口syscall<string> 触发错误的系统调用名称
error.address#>
- 类型:<string>
如果存在,error.address 是一个字符串,描述网络连接失败的地址。
【If present, error.address is a string describing the address to which a
network connection failed.】
error.code#>
- 类型:<string>
error.code 属性是表示错误代码的字符串。
【The error.code property is a string representing the error code.】
error.dest#>
- 类型:<string>
如果存在,error.dest 是报告文件系统错误时的文件路径目标。
【If present, error.dest is the file path destination when reporting a file
system error.】
error.errno#>
- 类型:<number>
error.errno 属性是一个负数,对应于 libuv Error handling 中定义的错误代码。
【The error.errno property is a negative number which corresponds
to the error code defined in libuv Error handling.】
在 Windows 上,系统提供的错误号将由 libuv 规范化。
【On Windows the error number provided by the system will be normalized by libuv.】
要获取错误代码的字符串表示形式,请使用 util.getSystemErrorName(error.errno)。
【To get the string representation of the error code, use
util.getSystemErrorName(error.errno).】
error.info#>
- 类型: <Object>
如果存在,error.info 是一个包含错误情况详细信息的对象。
【If present, error.info is an object with details about the error condition.】
error.message#>
- 类型:<string>
error.message 是系统提供的可供人类阅读的错误描述。
error.path#>
- 类型:<string>
如果存在,error.path 是一个包含相关无效路径名的字符串。
【If present, error.path is a string containing a relevant invalid pathname.】
error.port#>
- 类型:<number>
如果存在,error.port 是不可用的网络连接端口。
【If present, error.port is the network connection port that is not available.】
error.syscall#>
- 类型:<string>
error.syscall 属性是一个描述失败的 系统调用 的字符串。
【The error.syscall property is a string describing the syscall that failed.】
常见系统错误#>
【Common system errors】
这是一个在编写 Node.js 程序时常遇到的系统错误列表。有关完整列表,请参见 errno(3) 手册页。
【This is a list of system errors commonly-encountered when writing a Node.js
program. For a comprehensive list, see the errno(3) man page.】
EACCES(权限被拒绝):尝试以被文件访问权限禁止的方式访问文件。EADDRINUSE(地址已被使用):尝试将服务器(net、http或https)绑定到本地地址失败,因为本地系统上的另一个服务器已经占用了该地址。ECONNREFUSED(连接被拒绝):无法建立连接,因为目标机器主动拒绝了连接。这通常是由于尝试连接到远程主机上未启动的服务造成的。ECONNRESET(连接被对方重置):连接被对方强制关闭。通常这是由于远程套接字因超时或重启而导致连接丢失引起的。在使用http和net模块时经常会遇到。EEXIST(文件已存在):操作的目标文件已经存在,而该操作要求目标文件不存在。EISDIR(是一个目录):操作期望的是一个文件,但给定的路径名是一个目录。EMFILE(系统打开的文件过多):系统中允许的最大 文件描述符 数量已达到,直到至少关闭一个文件之前,无法处理对另一个描述符的请求。当同时并行打开许多文件时会遇到这种情况,尤其是在某些系统上(特别是 macOS),进程的文件描述符限制较低。要解决限制过低的问题,请在运行 Node.js 进程的同一终端中执行ulimit -n 2048。ENOENT(没有这样的文件或目录):通常由fs操作引发,用于指示指定路径名的某个组件不存在。给定路径找不到任何实体(文件或目录)。ENOTDIR(不是目录):指定路径中的某个部分存在,但并非预期的目录。通常由fs.readdir引发。ENOTEMPTY(目录非空):目标目录中有条目,而该操作需要目录为空,通常是fs.unlink。ENOTFOUND(DNS 查找失败):表示 DNS 失败,可能是EAI_NODATA或EAI_NONAME。这不是标准的 POSIX 错误。EPERM(操作不允许):尝试执行需要提升权限的操作。EPIPE(管道破裂):对没有进程读取数据的管道、套接字或 FIFO 进行写操作时出现的错误。通常在net和http层遇到,表示被写入的数据流的远端已关闭。ETIMEDOUT(操作超时):连接或发送请求失败,因为连接方在一段时间后未正确响应。通常在http或net中遇到。通常表示socket.end()未被正确调用。
类:TypeError#>
【Class: TypeError】
表示提供的参数类型不允许。例如,将一个函数传递给期望字符串的参数就会导致 TypeError(类型错误)。
【Indicates that a provided argument is not an allowable type. For example,
passing a function to a parameter which expects a string would be a TypeError.】
require('node:url').parse(() => { });
// Throws TypeError, since it expected a string.
Node.js 会立即生成并抛出 TypeError 实例,作为一种参数验证的形式。
【Node.js will generate and throw TypeError instances immediately as a form
of argument validation.】
异常与错误#>
【Exceptions vs. errors】
JavaScript 异常是由于无效操作或作为 throw 语句目标而抛出的值。虽然这些值不要求必须是 Error 的实例或继承自 Error 的类,但 Node.js 或 JavaScript 运行时抛出的所有异常 都会 是 Error 的实例。
【A JavaScript exception is a value that is thrown as a result of an invalid
operation or as the target of a throw statement. While it is not required
that these values are instances of Error or classes which inherit from
Error, all exceptions thrown by Node.js or the JavaScript runtime will be
instances of Error.】
有些异常在 JavaScript 层是不可恢复的。这类异常将始终导致 Node.js 进程崩溃。示例包括 C++ 层的 assert() 检查或 abort() 调用。
【Some exceptions are unrecoverable at the JavaScript layer. Such exceptions
will always cause the Node.js process to crash. Examples include assert()
checks or abort() calls in the C++ layer.】
OpenSSL 错误#>
【OpenSSL errors】
crypto 或 tls 中产生的错误属于 Error 类,除了标准的 .code 和 .message 属性外,可能还有一些额外的 OpenSSL 特有属性。
【Errors originating in crypto or tls are of class Error, and in addition to
the standard .code and .message properties, may have some additional
OpenSSL-specific properties.】
error.opensslErrorStack#>
一系列错误,可以提供上下文信息,说明错误在 OpenSSL 库中的来源位置。
【An array of errors that can give context to where in the OpenSSL library an error originates from.】
error.function#>
错误源自的 OpenSSL 函数。
【The OpenSSL function the error originates in.】
error.library#>
错误源自的 OpenSSL 库。
【The OpenSSL library the error originates in.】
error.reason#>
描述错误原因的人类可读的字符串。
【A human-readable string describing the reason for the error.】
Node.js 错误代码#>
【Node.js error codes】
ABORT_ERR#>
当操作被中止时使用(通常使用 AbortController)。
【Used when an operation has been aborted (typically using an AbortController).】
未使用 AbortSignal 的 API 通常不会抛出此错误代码。
【APIs not using AbortSignals typically do not raise an error with this code.】
此代码未使用 Node.js 错误中常用的 ERR_* 约定,以便兼容 Web 平台的 AbortError。
【This code does not use the regular ERR_* convention Node.js errors use in
order to be compatible with the web platform's AbortError.】
ERR_ACCESS_DENIED#>
一种特殊类型的错误,每当 Node.js 尝试访问被 权限模型 限制的资源时就会触发。
【A special type of error that is triggered whenever Node.js tries to get access to a resource restricted by the Permission Model.】
ERR_AMBIGUOUS_ARGUMENT#>
函数参数的使用方式表明函数签名可能被误解。当 assert.throws(block, message) 中的 message 参数与 block 抛出的错误消息匹配时,node:assert 模块会抛出此异常,因为这种用法表明用户认为 message 是预期消息,而不是当 block 未抛出异常时 AssertionError 将显示的消息。
【A function argument is being used in a way that suggests that the function
signature may be misunderstood. This is thrown by the node:assert module when
the message parameter in assert.throws(block, message) matches the error
message thrown by block because that usage suggests that the user believes
message is the expected message rather than the message the AssertionError
will display if block does not throw.】
ERR_ARG_NOT_ITERABLE#>
需要一个可迭代的参数(即可以与 for...of 循环一起使用的值),但未提供给 Node.js API。
【An iterable argument (i.e. a value that works with for...of loops) was
required, but not provided to a Node.js API.】
ERR_ASSERTION#>
一种特殊类型的错误,当 Node.js 检测到不应该发生的异常逻辑违规时会触发。通常由 node:assert 模块引发。
【A special type of error that can be triggered whenever Node.js detects an
exceptional logic violation that should never occur. These are raised typically
by the node:assert module.】
ERR_ASYNC_CALLBACK#>
尝试将非函数的内容注册为 AsyncHooks 回调。
【An attempt was made to register something that is not a function as an
AsyncHooks callback.】
ERR_ASYNC_TYPE#>
异步资源的类型无效。如果使用公共嵌入器 API,用户也可以定义自己的类型。
【The type of an asynchronous resource was invalid. Users are also able to define their own types if using the public embedder API.】
ERR_BROTLI_COMPRESSION_FAILED#>
传给 Brotli 流的数据未成功压缩。
【Data passed to a Brotli stream was not successfully compressed.】
ERR_BROTLI_INVALID_PARAM#>
在构建 Brotli 流期间传入了无效的参数键。
【An invalid parameter key was passed during construction of a Brotli stream.】
ERR_BUFFER_CONTEXT_NOT_AVAILABLE#>
尝试从 addon 或嵌入器代码创建一个 Node.js Buffer 实例时,所处的 JS 引擎上下文并未关联到 Node.js 实例。传递给 Buffer 方法的数据在方法返回时将已被释放。
【An attempt was made to create a Node.js Buffer instance from addon or embedder
code, while in a JS engine Context that is not associated with a Node.js
instance. The data passed to the Buffer method will have been released
by the time the method returns.】
遇到此错误时,创建 Buffer 实例的一个可能替代方法是创建一个普通的 Uint8Array,两者的区别仅在于生成对象的原型。Uint8Array 通常可以在所有接受 Buffer 的 Node.js 核心 API 中使用;它们在所有上下文中都可用。
【When encountering this error, a possible alternative to creating a Buffer
instance is to create a normal Uint8Array, which only differs in the
prototype of the resulting object. Uint8Arrays are generally accepted in all
Node.js core APIs where Buffers are; they are available in all Contexts.】
ERR_BUFFER_OUT_OF_BOUNDS#>
尝试进行了超出 Buffer 范围的操作。
【An operation outside the bounds of a Buffer was attempted.】
ERR_BUFFER_TOO_LARGE#>
尝试创建一个超过最大允许大小的 Buffer。
【An attempt has been made to create a Buffer larger than the maximum allowed
size.】
ERR_CANNOT_WATCH_SIGINT#>
Node.js 无法监听 SIGINT 信号。
【Node.js was unable to watch for the SIGINT signal.】
ERR_CHILD_CLOSED_BEFORE_REPLY#>
在父进程收到响应之前子进程已关闭。
【A child process was closed before the parent received a reply.】
ERR_CHILD_PROCESS_IPC_REQUIRED#>
当在没有指定进程间通信通道的情况下衍生子进程时使用。
【Used when a child process is being forked without specifying an IPC channel.】
ERR_CHILD_PROCESS_STDIO_MAXBUFFER#>
当主进程尝试从子进程的 STDERR/STDOUT 读取数据时使用,而数据的长度超过了 maxBuffer 选项。
【Used when the main process is trying to read data from the child process's
STDERR/STDOUT, and the data's length is longer than the maxBuffer option.】
ERR_CLOSED_MESSAGE_PORT#>
尝试在已关闭状态下使用 MessagePort 实例,通常是在调用 .close() 之后。
【There was an attempt to use a MessagePort instance in a closed
state, usually after .close() has been called.】
ERR_CONSOLE_WRITABLE_STREAM#>
Console 在没有 stdout 流的情况下被实例化,或者 Console 的 stdout 或 stderr 流不可写。
ERR_CONSTRUCT_CALL_INVALID#>
调用了不可调用的类构造函数。
【A class constructor was called that is not callable.】
ERR_CONSTRUCT_CALL_REQUIRED#>
类的构造函数在未使用 new 的情况下被调用。
【A constructor for a class was called without new.】
ERR_CONTEXT_NOT_INITIALIZED#>
传递给 API 的 vm 上下文尚未初始化。这可能发生在创建上下文时出现错误(并被捕获)的情况,例如,当分配失败或创建上下文时达到最大调用堆栈大小。
【The vm context passed into the API is not yet initialized. This could happen when an error occurs (and is caught) during the creation of the context, for example, when the allocation fails or the maximum call stack size is reached when the context is created.】
ERR_CPU_PROFILE_ALREADY_STARTED#>
具有给定名称的 CPU 配置文件已启动。
【The CPU profile with the given name is already started.】
ERR_CPU_PROFILE_NOT_STARTED#>
具有给定名称的 CPU 配置文件未启动。
【The CPU profile with the given name is not started.】
ERR_CPU_PROFILE_TOO_MANY#>
正在收集的 CPU 配置文件过多。
【There are too many CPU profiles being collected.】
ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED#>
请求了一个 OpenSSL 引擎(例如,通过 clientCertEngine 或 privateKeyEngine TLS 选项),但所使用的 OpenSSL 版本不支持该引擎,这很可能是由于编译时的标志 OPENSSL_NO_ENGINE 所致。
【An OpenSSL engine was requested (for example, through the clientCertEngine or
privateKeyEngine TLS options) that is not supported by the version of OpenSSL
being used, likely due to the compile-time flag OPENSSL_NO_ENGINE.】
ERR_CRYPTO_ECDH_INVALID_FORMAT#>
向 crypto.ECDH() 类的 getPublicKey() 方法传递了 format 参数的无效值。
【An invalid value for the format argument was passed to the crypto.ECDH()
class getPublicKey() method.】
ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY#>
向 crypto.ECDH() 类的 computeSecret() 方法传递了 key 参数的无效值。这意味着公钥位于椭圆曲线之外。
【An invalid value for the key argument has been passed to the
crypto.ECDH() class computeSecret() method. It means that the public
key lies outside of the elliptic curve.】
ERR_CRYPTO_ENGINE_UNKNOWN#>
向 require('node:crypto').setEngine() 传递了无效的加密引擎标识符。
【An invalid crypto engine identifier was passed to
require('node:crypto').setEngine().】
ERR_CRYPTO_FIPS_FORCED#>
使用了 --force-fips 命令行参数,但尝试在 node:crypto 模块中启用或禁用 FIPS 模式。
【The --force-fips command-line argument was used but there was an attempt
to enable or disable FIPS mode in the node:crypto module.】
ERR_CRYPTO_FIPS_UNAVAILABLE#>
尝试启用或禁用 FIPS 模式,但 FIPS 模式不可用。
【An attempt was made to enable or disable FIPS mode, but FIPS mode was not available.】
ERR_CRYPTO_HASH_FINALIZED#>
hash.digest() 被多次调用。每个 Hash 对象实例的 hash.digest() 方法最多只能调用一次。
ERR_CRYPTO_HASH_UPDATE_FAILED#>
hash.update() 由于某种原因失败。这种情况应该很少发生,甚至几乎不会发生。
ERR_CRYPTO_INCOMPATIBLE_KEY#>
给定的加密密钥与尝试的操作不兼容。
【The given crypto keys are incompatible with the attempted operation.】
ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS#>
所选的公钥或私钥编码与其他选项不兼容。
【The selected public or private key encoding is incompatible with other options.】
ERR_CRYPTO_INITIALIZATION_FAILED#>
加密子系统初始化失败。
【Initialization of the crypto subsystem failed.】
ERR_CRYPTO_INVALID_AUTH_TAG#>
提供了无效的身份验证标签。
【An invalid authentication tag was provided.】
ERR_CRYPTO_INVALID_COUNTER#>
为计数器模式密码提供了无效的计数器。
【An invalid counter was provided for a counter-mode cipher.】
ERR_CRYPTO_INVALID_CURVE#>
提供了无效的椭圆曲线。
【An invalid elliptic-curve was provided.】
ERR_CRYPTO_INVALID_DIGEST#>
指定了无效的 加密摘要算法。
【An invalid crypto digest algorithm was specified.】
ERR_CRYPTO_INVALID_IV#>
提供了无效的初始化向量。
【An invalid initialization vector was provided.】
ERR_CRYPTO_INVALID_JWK#>
提供了无效的 JSON 网络密钥。
【An invalid JSON Web Key was provided.】
ERR_CRYPTO_INVALID_KEYLEN#>
提供了无效的密钥长度。
【An invalid key length was provided.】
ERR_CRYPTO_INVALID_KEYPAIR#>
提供了无效的密钥对。
【An invalid key pair was provided.】
ERR_CRYPTO_INVALID_KEYTYPE#>
提供了无效的密钥类型。
【An invalid key type was provided.】
ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE#>
给定的加密密钥对象的类型对于尝试的操作无效。
【The given crypto key object's type is invalid for the attempted operation.】
ERR_CRYPTO_INVALID_MESSAGELEN#>
提供了无效的消息长度。
【An invalid message length was provided.】
ERR_CRYPTO_INVALID_SCRYPT_PARAMS#>
提供了无效的 scrypt 算法参数。
【Invalid scrypt algorithm parameters were provided.】
ERR_CRYPTO_INVALID_STATE#>
在处于无效状态的对象上使用了加密方法。例如,在调用 cipher.final() 之前调用 cipher.getAuthTag()。
【A crypto method was used on an object that was in an invalid state. For
instance, calling cipher.getAuthTag() before calling cipher.final().】
ERR_CRYPTO_INVALID_TAG_LENGTH#>
提供了无效的身份验证标签长度。
【An invalid authentication tag length was provided.】
ERR_CRYPTO_JOB_INIT_FAILED#>
异步加密操作的初始化失败。
【Initialization of an asynchronous crypto operation failed.】
ERR_CRYPTO_JWK_UNSUPPORTED_CURVE#>
该密钥的椭圆曲线未在 JSON 网络密钥椭圆曲线注册表 中注册使用。
【Key's Elliptic Curve is not registered for use in the JSON Web Key Elliptic Curve Registry.】
ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE#>
密钥的不对称密钥类型未在 JSON Web 密钥类型注册表 中注册使用。
【Key's Asymmetric Key Type is not registered for use in the JSON Web Key Types Registry.】
ERR_CRYPTO_OPERATION_FAILED#>
加密操作失败,原因不明。
【A crypto operation failed for an otherwise unspecified reason.】
ERR_CRYPTO_PBKDF2_ERROR#>
PBKDF2 算法因未指定原因失败。OpenSSL 没有提供更多细节,因此 Node.js 也没有提供。
【The PBKDF2 algorithm failed for unspecified reasons. OpenSSL does not provide more details and therefore neither does Node.js.】
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER#>
一个或多个 crypto.scrypt() 或 crypto.scryptSync() 参数超出其合法范围。
【One or more crypto.scrypt() or crypto.scryptSync() parameters are
outside their legal range.】
ERR_CRYPTO_SCRYPT_NOT_SUPPORTED#>
Node.js 是在没有 scrypt 支持的情况下编译的。使用官方发布的二进制文件无法实现,但自定义构建(包括发行版构建)可能会发生这种情况。
【Node.js was compiled without scrypt support. Not possible with the official
release binaries but can happen with custom builds, including distro builds.】
ERR_CRYPTO_SIGN_KEY_REQUIRED#>
没有向 sign.sign() 方法提供签名 key。
【A signing key was not provided to the sign.sign() method.】
ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH#>
crypto.timingSafeEqual() 被调用时,其 Buffer、TypedArray 或 DataView 参数长度不一致。
ERR_CRYPTO_UNKNOWN_CIPHER#>
指定了未知的密码。
【An unknown cipher was specified.】
ERR_CRYPTO_UNKNOWN_DH_GROUP#>
提供了一个未知的 Diffie-Hellman 组名。请参见 crypto.getDiffieHellman() 获取有效组名列表。
【An unknown Diffie-Hellman group name was given. See
crypto.getDiffieHellman() for a list of valid group names.】
ERR_CRYPTO_UNSUPPORTED_OPERATION#>
尝试调用不受支持的加密操作。
【An attempt to invoke an unsupported crypto operation was made.】
ERR_DEBUGGER_ERROR#>
调试器发生错误。
【An error occurred with the debugger.】
ERR_DEBUGGER_STARTUP_ERROR#>
调试器 等待所需的主机/端口可用时超时。
【The debugger timed out waiting for the required host/port to be free.】
ERR_DIR_CLOSED#>
fs.Dir之前已关闭。
【The fs.Dir was previously closed.】
ERR_DIR_CONCURRENT_OPERATION#>
在 fs.Dir 上尝试了同步读取或关闭调用,但该 fs.Dir 正在进行异步操作。
【A synchronous read or close call was attempted on an fs.Dir which has
ongoing asynchronous operations.】
ERR_DLOPEN_DISABLED#>
已使用 --no-addons 禁用加载本地插件。
【Loading native addons has been disabled using --no-addons.】
ERR_DLOPEN_FAILED#>
调用 process.dlopen() 失败。
【A call to process.dlopen() failed.】
ERR_DNS_SET_SERVERS_FAILED#>
c-ares 设置 DNS 服务器失败。
ERR_DOMAIN_CALLBACK_NOT_AVAILABLE#>
node:domain 模块无法使用,因为它无法建立所需的错误处理钩子,这是由于 process.setUncaughtExceptionCaptureCallback() 在先前的某个时间点已被调用造成的。
【The node:domain module was not usable since it could not establish the
required error handling hooks, because
process.setUncaughtExceptionCaptureCallback() had been called at an
earlier point in time.】
ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE#>
无法调用 process.setUncaughtExceptionCaptureCallback(),因为 node:domain 模块在之前已经被加载。
堆栈跟踪已扩展,以包括 node:domain 模块加载的时间点。
【The stack trace is extended to include the point in time at which the
node:domain module had been loaded.】
ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION#>
v8.startupSnapshot.setDeserializeMainFunction()无法被调用,因为它之前已经被调用过。
ERR_ENCODING_INVALID_ENCODED_DATA#>
根据提供的编码,提供给 TextDecoder() API 的数据无效。
【Data provided to TextDecoder() API was invalid according to the encoding
provided.】
ERR_ENCODING_NOT_SUPPORTED#>
提供给 TextDecoder() API 的编码不是 WHATWG 支持的编码 之一。
【Encoding provided to TextDecoder() API was not one of the
WHATWG Supported Encodings.】
ERR_EVAL_ESM_CANNOT_PRINT#>
--print 不能与 ESM 输入一起使用。
ERR_EVENT_RECURSION#>
当尝试在 EventTarget 上递归分派事件时抛出。
【Thrown when an attempt is made to recursively dispatch an event on EventTarget.】
ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE#>
JS 执行上下文未与 Node.js 环境关联。这可能发生在 Node.js 被用作嵌入式库时,并且 JS 引擎的一些钩子未正确设置。
【The JS execution context is not associated with a Node.js environment. This may occur when Node.js is used as an embedded library and some hooks for the JS engine are not set up properly.】
ERR_FALSY_VALUE_REJECTION#>
一个通过 util.callbackify() 回调化的 Promise 被拒绝,且拒绝值为假值。
【A Promise that was callbackified via util.callbackify() was rejected with a
falsy value.】
ERR_FEATURE_UNAVAILABLE_ON_PLATFORM#>
当使用当前运行 Node.js 的平台不支持的功能时使用。
【Used when a feature that is not available to the current platform which is running Node.js is used.】
ERR_FS_CP_DIR_TO_NON_DIR#>
尝试使用 fs.cp() 将目录复制到非目录(文件、符号链接等)时失败。
【An attempt was made to copy a directory to a non-directory (file, symlink,
etc.) using fs.cp().】
ERR_FS_CP_EEXIST#>
尝试复制一个已存在的文件 fs.cp(),并且 force 和 errorOnExist 被设置为 true。
【An attempt was made to copy over a file that already existed with
fs.cp(), with the force and errorOnExist set to true.】
ERR_FS_CP_EINVAL#>
使用 fs.cp() 时,src 或 dest 指向了无效的路径。
【When using fs.cp(), src or dest pointed to an invalid path.】
ERR_FS_CP_FIFO_PIPE#>
尝试使用 fs.cp() 复制命名管道。
【An attempt was made to copy a named pipe with fs.cp().】
ERR_FS_CP_NON_DIR_TO_DIR#>
尝试使用 fs.cp() 将非目录(文件、符号链接等)复制到目录中。
【An attempt was made to copy a non-directory (file, symlink, etc.) to a directory
using fs.cp().】
ERR_FS_CP_SOCKET#>
尝试使用 fs.cp() 复制到套接字。
【An attempt was made to copy to a socket with fs.cp().】
ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY#>
在使用 fs.cp() 时,dest 中的符号链接指向 src 的一个子目录。
【When using fs.cp(), a symlink in dest pointed to a subdirectory
of src.】
ERR_FS_CP_UNKNOWN#>
尝试使用 fs.cp() 复制到未知文件类型。
【An attempt was made to copy to an unknown file type with fs.cp().】
ERR_FS_EISDIR#>
路径是目录。
【Path is a directory.】
ERR_FS_FILE_TOO_LARGE#>
尝试读取一个大于 fs.readFile() 支持的 2 GiB 上限的文件。这不是 Buffer 的限制,而是内部 I/O 的约束。对于处理更大的文件,可以考虑使用 fs.createReadStream() 分块读取文件。
【An attempt was made to read a file larger than the supported 2 GiB limit for
fs.readFile(). This is not a limitation of Buffer, but an internal I/O constraint.
For handling larger files, consider using fs.createReadStream() to read the
file in chunks.】
ERR_FS_INVALID_SYMLINK_TYPE#>
传递给 fs.symlink() 或 fs.symlinkSync() 方法的符号链接类型无效。
【An invalid symlink type was passed to the fs.symlink() or
fs.symlinkSync() methods.】
ERR_FS_WATCH_QUEUE_OVERFLOW#>
未处理的文件系统事件队列的数量超过了 fs.watch() 中 maxQueue 指定的大小。
【The number of file system events queued without being handled exceeded the size specified in
maxQueue in fs.watch().】
ERR_HTTP2_ALTSVC_INVALID_ORIGIN#>
HTTP/2 ALTSVC 帧需要有效的来源。
【HTTP/2 ALTSVC frames require a valid origin.】
ERR_HTTP2_ALTSVC_LENGTH#>
HTTP/2 ALTSVC 帧限制为最多 16,382 个有效载荷字节。
【HTTP/2 ALTSVC frames are limited to a maximum of 16,382 payload bytes.】
ERR_HTTP2_CONNECT_AUTHORITY#>
对于使用 CONNECT 方法的 HTTP/2 请求,:authority 伪头是必需的。
【For HTTP/2 requests using the CONNECT method, the :authority pseudo-header
is required.】
ERR_HTTP2_CONNECT_PATH#>
对于使用 CONNECT 方法的 HTTP/2 请求,禁止使用 :path 伪头。
【For HTTP/2 requests using the CONNECT method, the :path pseudo-header is
forbidden.】
ERR_HTTP2_CONNECT_SCHEME#>
对于使用 CONNECT 方法的 HTTP/2 请求,禁止使用 :scheme 伪头。
【For HTTP/2 requests using the CONNECT method, the :scheme pseudo-header is
forbidden.】
ERR_HTTP2_ERROR#>
发生了非特定的 HTTP/2 错误。
【A non-specific HTTP/2 error has occurred.】
ERR_HTTP2_GOAWAY_SESSION#>
在 Http2Session 收到来自连接对端的 GOAWAY 帧后,可能无法打开新的 HTTP/2 流。
【New HTTP/2 Streams may not be opened after the Http2Session has received a
GOAWAY frame from the connected peer.】
ERR_HTTP2_HEADERS_AFTER_RESPOND#>
在启动 HTTP/2 响应后指定了额外的标头。
【An additional headers was specified after an HTTP/2 response was initiated.】
ERR_HTTP2_HEADERS_SENT#>
试图发送多个响应头。
【An attempt was made to send multiple response headers.】
ERR_HTTP2_HEADER_SINGLE_VALUE#>
为一个只允许有单一值的 HTTP/2 头字段提供了多个值。
【Multiple values were provided for an HTTP/2 header field that was required to have only a single value.】
ERR_HTTP2_INFO_STATUS_NOT_ALLOWED#>
信息性 HTTP 状态码(1xx)可能无法作为 HTTP/2 响应的状态码设置。
【Informational HTTP status codes (1xx) may not be set as the response status
code on HTTP/2 responses.】
ERR_HTTP2_INVALID_CONNECTION_HEADERS#>
HTTP/1 连接特定的头部在 HTTP/2 请求和响应中被禁止使用。
【HTTP/1 connection specific headers are forbidden to be used in HTTP/2 requests and responses.】
ERR_HTTP2_INVALID_HEADER_VALUE#>
指定了无效的 HTTP/2 标头值。
【An invalid HTTP/2 header value was specified.】
ERR_HTTP2_INVALID_INFO_STATUS#>
指定了无效的 HTTP 信息性状态码。信息性状态码必须是介于 100 到 199(包含)之间的整数。
【An invalid HTTP informational status code has been specified. Informational
status codes must be an integer between 100 and 199 (inclusive).】
ERR_HTTP2_INVALID_ORIGIN#>
HTTP/2 ORIGIN 帧需要一个有效的来源。
【HTTP/2 ORIGIN frames require a valid origin.】
ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH#>
传入 http2.getUnpackedSettings() API 的 Buffer 和 Uint8Array 实例的长度必须是六的倍数。
【Input Buffer and Uint8Array instances passed to the
http2.getUnpackedSettings() API must have a length that is a multiple of
six.】
ERR_HTTP2_INVALID_PSEUDOHEADER#>
只能使用有效的 HTTP/2 伪头(:status、:path、:authority、:scheme 和 :method)。
【Only valid HTTP/2 pseudoheaders (:status, :path, :authority, :scheme,
and :method) may be used.】
ERR_HTTP2_INVALID_SESSION#>
对已被销毁的 Http2Session 对象执行了操作。
【An action was performed on an Http2Session object that had already been
destroyed.】
ERR_HTTP2_INVALID_SETTING_VALUE#>
为 HTTP/2 设置指定了无效值。
【An invalid value has been specified for an HTTP/2 setting.】
ERR_HTTP2_INVALID_STREAM#>
对已被销毁的流执行了操作。
【An operation was performed on a stream that had already been destroyed.】
ERR_HTTP2_MAX_PENDING_SETTINGS_ACK#>
每当向已连接的对等方发送 HTTP/2 SETTINGS 帧时,对等方都必须发送确认,表明它已接收并应用了新的 SETTINGS。默认情况下,在任何给定时间可以发送的未确认 SETTINGS 帧数量是有限的。当达到该限制时,将使用此错误代码。
【Whenever an HTTP/2 SETTINGS frame is sent to a connected peer, the peer is
required to send an acknowledgment that it has received and applied the new
SETTINGS. By default, a maximum number of unacknowledged SETTINGS frames may
be sent at any given time. This error code is used when that limit has been
reached.】
ERR_HTTP2_NESTED_PUSH#>
尝试从一个推送流中启动新的推送流。嵌套推送流是不允许的。
【An attempt was made to initiate a new push stream from within a push stream. Nested push streams are not permitted.】
ERR_HTTP2_NO_MEM#>
使用 http2session.setLocalWindowSize(windowSize) API 时内存不足。
【Out of memory when using the http2session.setLocalWindowSize(windowSize) API.】
ERR_HTTP2_NO_SOCKET_MANIPULATION#>
尝试直接操作附加到 Http2Session 的套接字(读取、写入、暂停、恢复等)。
【An attempt was made to directly manipulate (read, write, pause, resume, etc.) a
socket attached to an Http2Session.】
ERR_HTTP2_ORIGIN_LENGTH#>
HTTP/2 ORIGIN 帧的长度限制为 16382 字节。
【HTTP/2 ORIGIN frames are limited to a length of 16382 bytes.】
ERR_HTTP2_OUT_OF_STREAMS#>
在单个 HTTP/2 会话中创建的流数量已达到最大限制。
【The number of streams created on a single HTTP/2 session reached the maximum limit.】
ERR_HTTP2_PAYLOAD_FORBIDDEN#>
为不允许包含有效负载的 HTTP 响应代码指定了消息有效负载。
【A message payload was specified for an HTTP response code for which a payload is forbidden.】
ERR_HTTP2_PING_CANCEL#>
HTTP/2 发送回显信息被取消。
【An HTTP/2 ping was canceled.】
ERR_HTTP2_PING_LENGTH#>
HTTP/2 发送回显信息负载的长度必须正好是 8 个字节。
【HTTP/2 ping payloads must be exactly 8 bytes in length.】
ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED#>
HTTP/2 伪头被不当使用。伪头是以 : 前缀开头的头部键名。
【An HTTP/2 pseudo-header has been used inappropriately. Pseudo-headers are header
key names that begin with the : prefix.】
ERR_HTTP2_PUSH_DISABLED#>
尝试创建一个推送流,但该操作已被客户端禁用。
【An attempt was made to create a push stream, which had been disabled by the client.】
ERR_HTTP2_SEND_FILE#>
尝试使用 Http2Stream.prototype.responseWithFile() API 发送一个目录。
【An attempt was made to use the Http2Stream.prototype.responseWithFile() API to
send a directory.】
ERR_HTTP2_SEND_FILE_NOSEEK#>
尝试使用 Http2Stream.prototype.responseWithFile() API 发送非普通文件的内容,但提供了 offset 或 length 选项。
【An attempt was made to use the Http2Stream.prototype.responseWithFile() API to
send something other than a regular file, but offset or length options were
provided.】
ERR_HTTP2_SESSION_ERROR#>
Http2Session 以非零错误码关闭。
【The Http2Session closed with a non-zero error code.】
ERR_HTTP2_SETTINGS_CANCEL#>
Http2Session 设置已取消。
【The Http2Session settings canceled.】
ERR_HTTP2_SOCKET_BOUND#>
尝试将一个 Http2Session 对象连接到一个已绑定到另一个 Http2Session 对象的 net.Socket 或 tls.TLSSocket 上。
【An attempt was made to connect a Http2Session object to a net.Socket or
tls.TLSSocket that had already been bound to another Http2Session object.】
ERR_HTTP2_SOCKET_UNBOUND#>
尝试使用已关闭的 Http2Session 的 socket 属性。
【An attempt was made to use the socket property of an Http2Session that
has already been closed.】
ERR_HTTP2_STATUS_101#>
在 HTTP/2 中禁止使用 101 信息状态码。
【Use of the 101 Informational status code is forbidden in HTTP/2.】
ERR_HTTP2_STATUS_INVALID#>
指定了无效的 HTTP 状态码。状态码必须是介于 100 到 599(含)之间的整数。
【An invalid HTTP status code has been specified. Status codes must be an integer
between 100 and 599 (inclusive).】
ERR_HTTP2_STREAM_CANCEL#>
在向已连接的对端传输任何数据之前,Http2Stream 已被销毁。
【An Http2Stream was destroyed before any data was transmitted to the connected
peer.】
ERR_HTTP2_STREAM_ERROR#>
在 RST_STREAM 帧中指定了非零错误代码。
【A non-zero error code was been specified in an RST_STREAM frame.】
ERR_HTTP2_STREAM_SELF_DEPENDENCY#>
在为 HTTP/2 流设置优先级时,该流可能会被标记为父流的依赖。当尝试将流标记为自身的依赖时,会使用此错误代码。
【When setting the priority for an HTTP/2 stream, the stream may be marked as a dependency for a parent stream. This error code is used when an attempt is made to mark a stream and dependent of itself.】
ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS#>
已超出支持的自定义设置数量 (10)。
【The number of supported custom settings (10) has been exceeded.】
ERR_HTTP2_TOO_MANY_INVALID_FRAMES#>
通过 maxSessionInvalidFrames 选项指定的对等方可接受的无效 HTTP/2 协议帧的限制已被超出。
【The limit of acceptable invalid HTTP/2 protocol frames sent by the peer,
as specified through the maxSessionInvalidFrames option, has been exceeded.】
ERR_HTTP2_TRAILERS_ALREADY_SENT#>
Http2Stream 上的尾部头已经发送。
【Trailing headers have already been sent on the Http2Stream.】
ERR_HTTP2_TRAILERS_NOT_READY#>
http2stream.sendTrailers() 方法在 Http2Stream 对象触发 'wantTrailers' 事件之前无法调用。只有在为 Http2Stream 设置了 waitForTrailers 选项时,才会触发 'wantTrailers' 事件。
【The http2stream.sendTrailers() method cannot be called until after the
'wantTrailers' event is emitted on an Http2Stream object. The
'wantTrailers' event will only be emitted if the waitForTrailers option
is set for the Http2Stream.】
ERR_HTTP2_UNSUPPORTED_PROTOCOL#>
http2.connect() 接收到的 URL 使用了除 http: 或 https: 之外的其他协议。
ERR_HTTP_BODY_NOT_ALLOWED#>
当向不允许内容的 HTTP 响应写入时,会抛出错误。
【An error is thrown when writing to an HTTP response which does not allow contents.】
ERR_HTTP_CONTENT_LENGTH_MISMATCH#>
响应正文大小与指定的内容长度标头值不匹配。
【Response body size doesn't match with the specified content-length header value.】
ERR_HTTP_HEADERS_SENT#>
在已发送标头后尝试添加更多标头。
【An attempt was made to add more headers after the headers had already been sent.】
ERR_HTTP_INVALID_HEADER_VALUE#>
指定了无效的 HTTP 标头值。
【An invalid HTTP header value was specified.】
ERR_HTTP_INVALID_STATUS_CODE#>
状态代码超出了常规状态码的范围(100-999)。
【Status code was outside the regular status code range (100-999).】
ERR_HTTP_REQUEST_TIMEOUT#>
客户端没有在允许的时间内发送整个请求。
【The client has not sent the entire request within the allowed time.】
ERR_HTTP_SOCKET_ASSIGNED#>
给定的 ServerResponse 已经分配了一个插座。
【The given ServerResponse was already assigned a socket.】
ERR_HTTP_SOCKET_ENCODING#>
根据 RFC 7230 第3节,不允许更改套接字编码。
【Changing the socket encoding is not allowed per RFC 7230 Section 3.】
ERR_HTTP_TRAILER_INVALID#>
Trailer 头已设置,即使传输编码不支持该操作。
【The Trailer header was set even though the transfer encoding does not support
that.】
ERR_ILLEGAL_CONSTRUCTOR#>
尝试使用非公共构造函数构造对象。
【An attempt was made to construct an object using a non-public constructor.】
ERR_IMPORT_ATTRIBUTE_MISSING#>
缺少导入属性,导致无法导入指定的模块。
【An import attribute is missing, preventing the specified module to be imported.】
ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE#>
提供了导入的 type 属性,但指定的模块类型不同。
【An import type attribute was provided, but the specified module is of a
different type.】
ERR_IMPORT_ATTRIBUTE_UNSUPPORTED#>
此版本的 Node.js 不支持导入属性。
【An import attribute is not supported by this version of Node.js.】
ERR_INCOMPATIBLE_OPTION_PAIR#>
一对选项彼此不兼容,不能同时使用。
【An option pair is incompatible with each other and cannot be used at the same time.】
ERR_INPUT_TYPE_NOT_ALLOWED#>
--input-type 标志被用于尝试执行一个文件。该标志只能与通过 --eval、--print 或 STDIN 输入时使用。
【The --input-type flag was used to attempt to execute a file. This flag can
only be used with input via --eval, --print, or STDIN.】
ERR_INSPECTOR_ALREADY_ACTIVATED#>
在使用 node:inspector 模块时,尝试在检查器已经开始监听端口时激活它。在在不同地址上激活之前,请使用 inspector.close()。
【While using the node:inspector module, an attempt was made to activate the
inspector when it already started to listen on a port. Use inspector.close()
before activating it on a different address.】
ERR_INSPECTOR_ALREADY_CONNECTED#>
在使用 node:inspector 模块时,尝试连接时发现调试器已被连接。
【While using the node:inspector module, an attempt was made to connect when the
inspector was already connected.】
ERR_INSPECTOR_CLOSED#>
在使用 node:inspector 模块时,尝试在会话已经关闭后使用调试器。
【While using the node:inspector module, an attempt was made to use the
inspector after the session had already closed.】
ERR_INSPECTOR_COMMAND#>
通过 node:inspector 模块发出命令时发生错误。
【An error occurred while issuing a command via the node:inspector module.】
ERR_INSPECTOR_NOT_ACTIVE#>
当调用 inspector.waitForDebugger() 时,inspector 未处于活动状态。
【The inspector is not active when inspector.waitForDebugger() is called.】
ERR_INSPECTOR_NOT_AVAILABLE#>
node:inspector 模块不可使用。
【The node:inspector module is not available for use.】
ERR_INSPECTOR_NOT_CONNECTED#>
在使用 node:inspector 模块时,尝试在连接之前使用 inspector。
【While using the node:inspector module, an attempt was made to use the
inspector before it was connected.】
ERR_INSPECTOR_NOT_WORKER#>
在主线程上调用了一个只能在工作线程中使用的 API。
【An API was called on the main thread that can only be used from the worker thread.】
ERR_INTERNAL_ASSERTION#>
Node.js 中存在一个错误或 Node.js 内部使用不当。 要解决此错误,请在 https://github.com/nodejs/node/issues 提交一个问题。
ERR_INVALID_ADDRESS#>
Node.js API 无法理解提供的地址。
【The provided address is not understood by the Node.js API.】
ERR_INVALID_ADDRESS_FAMILY#>
Node.js API 无法识别提供的地址族。
【The provided address family is not understood by the Node.js API.】
ERR_INVALID_ARG_TYPE#>
传给 Node.js API 的参数类型错误。
【An argument of the wrong type was passed to a Node.js API.】
ERR_INVALID_ARG_VALUE#>
为给定参数传入了无效或不受支持的值。
【An invalid or unsupported value was passed for a given argument.】
ERR_INVALID_ASYNC_ID#>
使用 AsyncHooks 传递了无效的 asyncId 或 triggerAsyncId。ID 小于 -1 的情况不应发生。
【An invalid asyncId or triggerAsyncId was passed using AsyncHooks. An id
less than -1 should never happen.】
ERR_INVALID_BUFFER_SIZE#>
对 Buffer 执行了交换操作,但其大小与操作不兼容。
【A swap was performed on a Buffer but its size was not compatible with the
operation.】
ERR_INVALID_CHAR#>
在标头中检测到无效字符。
【Invalid characters were detected in headers.】
ERR_INVALID_CURSOR_POS#>
在给定的数据流上,游标无法移动到指定的行而不指定列。
【A cursor on a given stream cannot be moved to a specified row without a specified column.】
ERR_INVALID_FD#>
文件描述符('fd')无效(例如,它是负值)。
【A file descriptor ('fd') was not valid (e.g. it was a negative value).】
ERR_INVALID_FD_TYPE#>
文件描述符('fd')类型无效。
【A file descriptor ('fd') type was not valid.】
ERR_INVALID_FILE_URL_HOST#>
一个使用 Node.js 的 API 消费 file: URL(例如 fs 模块中的某些函数)时,遇到了具有不兼容主机的文件 URL。此情况只会发生在类 Unix 系统上,因为这些系统只支持 localhost 或空主机。
【A Node.js API that consumes file: URLs (such as certain functions in the
fs module) encountered a file URL with an incompatible host. This
situation can only occur on Unix-like systems where only localhost or an empty
host is supported.】
ERR_INVALID_FILE_URL_PATH#>
一个使用 Node.js 的 API,它可以处理 file: URL(例如 fs 模块中的某些函数),遇到了路径不兼容的文件 URL。判断路径是否可用的具体语义取决于平台。
【A Node.js API that consumes file: URLs (such as certain functions in the
fs module) encountered a file URL with an incompatible path. The exact
semantics for determining whether a path can be used is platform-dependent.】
抛出的错误对象包含一个 input 属性,该属性包含无效 file: URL 的 URL 对象。
【The thrown error object includes an input property that contains the URL object
of the invalid file: URL.】
ERR_INVALID_HANDLE_TYPE#>
尝试通过 IPC 通信通道向子进程发送不受支持的“句柄”。更多信息请参见 subprocess.send() 和 process.send()。
【An attempt was made to send an unsupported "handle" over an IPC communication
channel to a child process. See subprocess.send() and process.send()
for more information.】
ERR_INVALID_HTTP_TOKEN#>
提供了无效的 HTTP 令牌。
【An invalid HTTP token was supplied.】
ERR_INVALID_IP_ADDRESS#>
IP 地址无效。
【An IP address is not valid.】
ERR_INVALID_MIME_SYNTAX#>
MIME 语法无效。
【The syntax of a MIME is not valid.】
ERR_INVALID_MODULE#>
尝试加载不存在或无效的模块。
【An attempt was made to load a module that does not exist or was otherwise not valid.】
ERR_INVALID_MODULE_SPECIFIER#>
导入的模块字符串是无效的 URL、包名或包子路径指定符。
【The imported module string is an invalid URL, package name, or package subpath specifier.】
ERR_INVALID_OBJECT_DEFINE_PROPERTY#>
在对象的属性上设置无效属性时发生错误。
【An error occurred while setting an invalid attribute on the property of an object.】
ERR_INVALID_PACKAGE_CONFIG#>
无效的 package.json 文件解析失败。
【An invalid package.json file failed parsing.】
ERR_INVALID_PACKAGE_TARGET#>
package.json 文件中的 "exports" 字段包含一个用于尝试模块解析的无效目标映射值。
【The package.json "exports" field contains an invalid target mapping
value for the attempted module resolution.】
ERR_INVALID_PROTOCOL#>
向 http.request() 传递了无效的 options.protocol。
【An invalid options.protocol was passed to http.request().】
ERR_INVALID_REPL_EVAL_CONFIG#>
在 REPL 配置中同时设置了 breakEvalOnSigint 和 eval 选项,这是不被支持的。
【Both breakEvalOnSigint and eval options were set in the REPL config,
which is not supported.】
ERR_INVALID_REPL_INPUT#>
该输入可能无法在 REPL 中使用。触发此错误的条件在 REPL 文档中进行了说明。
【The input may not be used in the REPL. The conditions under which this
error is used are described in the REPL documentation.】
ERR_INVALID_RETURN_PROPERTY#>
在函数选项在执行时未能为其返回对象的某个属性提供有效值的情况下抛出。
【Thrown in case a function option does not provide a valid value for one of its returned object properties on execution.】
ERR_INVALID_RETURN_PROPERTY_VALUE#>
当函数选项在执行时未为其返回对象的某个属性提供预期类型的值时抛出。
【Thrown in case a function option does not provide an expected value type for one of its returned object properties on execution.】
ERR_INVALID_RETURN_VALUE#>
在函数选项未返回预期类型的值时抛出,例如当函数预计返回一个 Promise 时。
【Thrown in case a function option does not return an expected value type on execution, such as when a function is expected to return a promise.】
ERR_INVALID_STATE#>
表示由于状态无效,操作无法完成。例如,对象可能已经被销毁,或者正在执行其他操作。
【Indicates that an operation cannot be completed due to an invalid state. For instance, an object may have already been destroyed, or may be performing another operation.】
ERR_INVALID_SYNC_FORK_INPUT#>
一个 Buffer、TypedArray、DataView 或 string 被作为 stdio 输入提供给异步 fork。有关更多信息,请参阅 child_process 模块的文档。
【A Buffer, TypedArray, DataView, or string was provided as stdio input to
an asynchronous fork. See the documentation for the child_process module
for more information.】
ERR_INVALID_THIS#>
调用 Node.js API 函数时使用了不兼容的 this 值。
【A Node.js API function was called with an incompatible this value.】
const urlSearchParams = new URLSearchParams('foo=bar&baz=new');
const buf = Buffer.alloc(1);
urlSearchParams.has.call(buf, 'foo');
// Throws a TypeError with code 'ERR_INVALID_THIS'
ERR_INVALID_TUPLE#>
提供给 WHATWG URLSearchParams 构造函数 的 iterable 中的一个元素并不表示 [name, value] 元组——也就是说,如果某个元素不可迭代,或者不包含恰好两个元素。
【An element in the iterable provided to the WHATWG
URLSearchParams constructor did not
represent a [name, value] tuple – that is, if an element is not iterable, or
does not consist of exactly two elements.】
ERR_INVALID_TYPESCRIPT_SYNTAX#>
提供的 TypeScript 语法无效。
【The provided TypeScript syntax is not valid.】
ERR_INVALID_URI#>
传入了无效的网址。
【An invalid URI was passed.】
ERR_INVALID_URL#>
向 WHATWG、URL 构造函数 或旧版 url.parse() 传递了一个无效的 URL 以进行解析。抛出的错误对象通常具有一个附加属性 'input',其中包含解析失败的 URL。
【An invalid URL was passed to the WHATWG URL
constructor or the legacy url.parse() to be parsed.
The thrown error object typically has an additional property 'input' that
contains the URL that failed to parse.】
ERR_INVALID_URL_SCHEME#>
尝试使用不兼容方案(协议)的 URL 来实现特定目的。它仅在 fs 模块的 WHATWG URL API 支持中使用(该模块仅接受带有 'file' 方案的 URL),但将来可能也会在其他 Node.js API 中使用。
【An attempt was made to use a URL of an incompatible scheme (protocol) for a
specific purpose. It is only used in the WHATWG URL API support in the
fs module (which only accepts URLs with 'file' scheme), but may be used
in other Node.js APIs as well in the future.】
ERR_IPC_CHANNEL_CLOSED#>
尝试使用已关闭的进程间通信通道。
【An attempt was made to use an IPC communication channel that was already closed.】
ERR_IPC_DISCONNECTED#>
尝试断开一个已经断开的 IPC 通信通道。有关更多信息,请参见 child_process 模块的文档。
【An attempt was made to disconnect an IPC communication channel that was already
disconnected. See the documentation for the child_process module
for more information.】
ERR_IPC_ONE_PIPE#>
尝试使用多个 IPC 通信通道创建子 Node.js 进程。有关更多信息,请参阅 child_process 模块的文档。
【An attempt was made to create a child Node.js process using more than one IPC
communication channel. See the documentation for the child_process module
for more information.】
ERR_IPC_SYNC_FORK#>
尝试与一个同步分叉的 Node.js 进程打开 IPC 通信通道。更多信息请参阅 child_process 模块的文档。
【An attempt was made to open an IPC communication channel with a synchronously
forked Node.js process. See the documentation for the child_process module
for more information.】
ERR_IP_BLOCKED#>
IP 被 net.BlockList 阻止。
【IP is blocked by net.BlockList.】
ERR_LOADER_CHAIN_INCOMPLETE#>
ESM 加载器钩子在未调用 next() 并且未明确表示短路的情况下返回。
【An ESM loader hook returned without calling next() and without explicitly
signaling a short circuit.】
ERR_LOAD_SQLITE_EXTENSION#>
加载 SQLite 扩展时发生错误。
【An error occurred while loading a SQLite extension.】
ERR_MEMORY_ALLOCATION_FAILED#>
尝试分配内存(通常在 C++ 层)时失败了。
【An attempt was made to allocate memory (usually in the C++ layer) but it failed.】
ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE#>
发布到 MessagePort 的消息无法在目标 虚拟机 Context 中反序列化。目前,并非所有 Node.js 对象都能在任何上下文中成功实例化,在这种情况下,使用 postMessage() 传输它们可能会导致接收端失败。
【A message posted to a MessagePort could not be deserialized in the target
vm Context. Not all Node.js objects can be successfully instantiated in
any context at this time, and attempting to transfer them using postMessage()
can fail on the receiving side in that case.】
ERR_METHOD_NOT_IMPLEMENTED#>
需要方法,但未实现。
【A method is required but not implemented.】
ERR_MISSING_ARGS#>
Node.js API 的一个必需参数未传递。这仅用于严格遵循 API 规范(在某些情况下,规范可能接受 func(undefined),但不接受 func())。在大多数原生 Node.js API 中,func(undefined) 和 func() 被视为相同,且可以使用 ERR_INVALID_ARG_TYPE 错误代码。
【A required argument of a Node.js API was not passed. This is only used for
strict compliance with the API specification (which in some cases may accept
func(undefined) but not func()). In most native Node.js APIs,
func(undefined) and func() are treated identically, and the
ERR_INVALID_ARG_TYPE error code may be used instead.】
ERR_MISSING_OPTION#>
对于接受选项对象的 API,某些选项可能是必需的。如果缺少必需的选项,将会抛出这段代码。
【For APIs that accept options objects, some options might be mandatory. This code is thrown if a required option is missing.】
ERR_MISSING_PASSPHRASE#>
已尝试在未指定密码的情况下读取加密密钥。
【An attempt was made to read an encrypted key without specifying a passphrase.】
ERR_MISSING_PLATFORM_FOR_WORKER#>
此 Node.js 实例使用的 V8 平台不支持创建 Workers。这是由于嵌入器对 Workers 缺乏支持引起的。尤其是,使用标准构建的 Node.js 不会出现此错误。
【The V8 platform used by this instance of Node.js does not support creating Workers. This is caused by lack of embedder support for Workers. In particular, this error will not occur with standard builds of Node.js.】
ERR_MODULE_LINK_MISMATCH#>
无法链接模块,因为其中请求的相同模块未解析为相同的模块。
【A module can not be linked because the same module requests in it are not resolved to the same module.】
ERR_MODULE_NOT_FOUND#>
在尝试 import 操作或加载程序入口点时,ECMAScript 模块加载器无法解析模块文件。
【A module file could not be resolved by the ECMAScript modules loader while
attempting an import operation or when loading the program entry point.】
ERR_MULTIPLE_CALLBACK#>
回调被多次调用。
【A callback was called more than once.】
回调几乎总是只应被调用一次,因为查询要么可以被完成,要么可以被拒绝,但不能同时发生。如果多次调用回调,则可能出现后者情况。
【A callback is almost always meant to only be called once as the query can either be fulfilled or rejected but not both at the same time. The latter would be possible by calling a callback more than once.】
ERR_NAPI_CONS_FUNCTION#>
在使用 Node-API 时,传入的构造函数不是一个函数。
【While using Node-API, a constructor passed was not a function.】
ERR_NAPI_INVALID_DATAVIEW_ARGS#>
在调用 napi_create_dataview() 时,给定的 offset 超出了 DataView 的范围,或者 offset + length 大于给定 buffer 的长度。
【While calling napi_create_dataview(), a given offset was outside the bounds
of the dataview or offset + length was larger than a length of given buffer.】
ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT#>
在调用 napi_create_typedarray() 时,提供的 offset 不是元素大小的倍数。
【While calling napi_create_typedarray(), the provided offset was not a
multiple of the element size.】
ERR_NAPI_INVALID_TYPEDARRAY_LENGTH#>
在调用 napi_create_typedarray() 时,(length * size_of_element) + byte_offset 大于给定 buffer 的长度。
【While calling napi_create_typedarray(), (length * size_of_element) + byte_offset was larger than the length of given buffer.】
ERR_NAPI_TSFN_CALL_JS#>
在调用线程安全函数的 JavaScript 部分时发生了错误。
【An error occurred while invoking the JavaScript portion of the thread-safe function.】
ERR_NAPI_TSFN_GET_UNDEFINED#>
尝试检索 JavaScript undefined 值时发生错误。
【An error occurred while attempting to retrieve the JavaScript undefined
value.】
ERR_NON_CONTEXT_AWARE_DISABLED#>
在不允许加载的进程中加载了非上下文感知的原生插件。
【A non-context-aware native addon was loaded in a process that disallows them.】
ERR_NOT_BUILDING_SNAPSHOT#>
尝试使用只能在构建 V8 启动快照时使用的操作,但 Node.js 并未构建此快照。
【An attempt was made to use operations that can only be used when building V8 startup snapshot even though Node.js isn't building one.】
ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION#>
当它不在单一可执行应用中时,无法执行该操作。
【The operation cannot be performed when it's not in a single-executable application.】
ERR_NOT_SUPPORTED_IN_SNAPSHOT#>
在构建启动快照时尝试执行不支持的操作。
【An attempt was made to perform operations that are not supported when building a startup snapshot.】
ERR_NO_CRYPTO#>
在 Node.js 未使用 OpenSSL 加密支持编译的情况下尝试使用加密功能。
【An attempt was made to use crypto features while Node.js was not compiled with OpenSSL crypto support.】
ERR_NO_ICU#>
尝试使用需要 重症监护室 的功能,但 Node.js 未启用 ICU 支持进行编译。
【An attempt was made to use features that require ICU, but Node.js was not compiled with ICU support.】
ERR_NO_TYPESCRIPT#>
尝试使用需要 原生 TypeScript 支持 的功能,但 Node.js 并未编译以支持 TypeScript。
【An attempt was made to use features that require Native TypeScript support, but Node.js was not compiled with TypeScript support.】
ERR_OPERATION_FAILED#>
操作失败。通常用于表示异步操作的一般失败。
【An operation failed. This is typically used to signal the general failure of an asynchronous operation.】
ERR_OPTIONS_BEFORE_BOOTSTRAPPING#>
在引导完成之前尝试获取选项。
【An attempt was made to get options before the bootstrapping was completed.】
ERR_OUT_OF_RANGE#>
给定的值超出了可接受的范围。
【A given value is out of the accepted range.】
ERR_PACKAGE_IMPORT_NOT_DEFINED#>
package.json 文件中的 "imports" 字段未定义给定的内部包规范映射。
【The package.json "imports" field does not define the given internal
package specifier mapping.】
ERR_PACKAGE_PATH_NOT_EXPORTED#>
package.json 的 "exports" 字段未导出所请求的子路径。由于导出是封装的,未导出的私有内部模块不能通过包解析进行导入,除非使用绝对 URL。
【The package.json "exports" field does not export the requested subpath.
Because exports are encapsulated, private internal modules that are not exported
cannot be imported through the package resolution, unless using an absolute URL.】
ERR_PARSE_ARGS_INVALID_OPTION_VALUE#>
当 strict 设置为 true 时,如果为类型为 <string> 的选项提供了 <boolean> 值,或者为类型为 <boolean> 的选项提供了 <string> 值,将由 util.parseArgs() 抛出。
【When strict set to true, thrown by util.parseArgs() if a <boolean>
value is provided for an option of type <string>, or if a <string>
value is provided for an option of type <boolean>.】
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL#>
由 util.parseArgs() 抛出,当提供了位置参数且 allowPositionals 设置为 false 时。
【Thrown by util.parseArgs(), when a positional argument is provided and
allowPositionals is set to false.】
ERR_PARSE_ARGS_UNKNOWN_OPTION#>
当 strict 设置为 true 时,如果 options 中没有配置某个参数,将由 util.parseArgs() 抛出。
【When strict set to true, thrown by util.parseArgs() if an argument
is not configured in options.】
ERR_PERFORMANCE_INVALID_TIMESTAMP#>
为性能标记或度量提供了无效的时间戳值。
【An invalid timestamp value was provided for a performance mark or measure.】
ERR_PERFORMANCE_MEASURE_INVALID_OPTIONS#>
为性能度量提供了无效选项。
【Invalid options were provided for a performance measure.】
ERR_PROTO_ACCESS#>
使用 --disable-proto=throw 已禁止访问 Object.prototype.__proto__。应该使用 Object.getPrototypeOf 和 Object.setPrototypeOf 来获取和设置对象的原型。
【Accessing Object.prototype.__proto__ has been forbidden using
--disable-proto=throw. Object.getPrototypeOf and
Object.setPrototypeOf should be used to get and set the prototype of an
object.】
ERR_PROXY_INVALID_CONFIG#>
由于代理配置无效,无法代理请求。
【Failed to proxy a request because the proxy configuration is invalid.】
ERR_PROXY_TUNNEL#>
启用 NODE_USE_ENV_PROXY 或 --use-env-proxy 时,无法建立代理隧道。
【Failed to establish proxy tunnel when NODE_USE_ENV_PROXY or --use-env-proxy is enabled.】
ERR_QUIC_APPLICATION_ERROR#>
发生 QUIC 应用错误。
【A QUIC application error occurred.】
ERR_QUIC_CONNECTION_FAILED#>
建立 QUIC 连接失败。
【Establishing a QUIC connection failed.】
ERR_QUIC_ENDPOINT_CLOSED#>
QUIC 端点因错误而关闭。
【A QUIC Endpoint closed with an error.】
ERR_QUIC_OPEN_STREAM_FAILED#>
打开 QUIC 流失败。
【Opening a QUIC stream failed.】
ERR_QUIC_TRANSPORT_ERROR#>
发生 QUIC 传输错误。
【A QUIC transport error occurred.】
ERR_QUIC_VERSION_NEGOTIATION_ERROR#>
由于需要版本协商,QUIC 会话失败。
【A QUIC session failed because version negotiation is required.】
ERR_REQUIRE_ASYNC_MODULE#>
在尝试 require() ES 模块 时,模块却是异步的。也就是说,它包含顶层 await。
【When trying to require() a ES Module, the module turns out to be asynchronous.
That is, it contains top-level await.】
要查看顶层 await 出现的位置,请使用 --experimental-print-required-tla(这会在查找顶层 await 之前先执行模块)。
【To see where the top-level await is, use
--experimental-print-required-tla (this would execute the modules
before looking for the top-level awaits).】
ERR_REQUIRE_CYCLE_MODULE#>
当尝试 require() 一个 ES 模块 时,一个 CommonJS 到 ESM 或 ESM 到 CommonJS 的边缘情况会参与到一个即时循环中。这是不允许的,因为 ES 模块在已经被评估时无法再次被评估。
【When trying to require() a ES Module, a CommonJS to ESM or ESM to CommonJS edge
participates in an immediate cycle.
This is not allowed because ES Modules cannot be evaluated while they are
already being evaluated.】
为了避免循环,涉及循环的 require() 调用不应发生在 ES 模块(通过 createRequire())或 CommonJS 模块的顶层,而应在内部函数中延迟执行。
【To avoid the cycle, the require() call involved in a cycle should not happen
at the top-level of either an ES Module (via createRequire()) or a CommonJS
module, and should be done lazily in an inner function.】
ERR_REQUIRE_ESM#>
尝试 require() 一个 ES 模块。
【An attempt was made to require() an ES Module.】
自从 require() 现在支持加载同步 ES 模块以来,此错误已被弃用。当 require() 遇到包含顶层 await 的 ES 模块时,它将抛出 ERR_REQUIRE_ASYNC_MODULE 错误。
【This error has been deprecated since require() now supports loading synchronous
ES modules. When require() encounters an ES module that contains top-level
await, it will throw ERR_REQUIRE_ASYNC_MODULE instead.】
ERR_SCRIPT_EXECUTION_INTERRUPTED#>
脚本执行被 SIGINT 中断(例如,按下了 Ctrl+C )。
ERR_SCRIPT_EXECUTION_TIMEOUT#>
脚本执行超时,可能是由于正在执行的脚本中存在错误。
【Script execution timed out, possibly due to bugs in the script being executed.】
ERR_SERVER_ALREADY_LISTEN#>
在 net.Server 已经处于监听状态时调用了 server.listen() 方法。这适用于所有 net.Server 实例,包括 HTTP、HTTPS 和 HTTP/2 Server 实例。
【The server.listen() method was called while a net.Server was already
listening. This applies to all instances of net.Server, including HTTP, HTTPS,
and HTTP/2 Server instances.】
ERR_SERVER_NOT_RUNNING#>
当 net.Server 未运行时会调用 server.close() 方法。这适用于所有 net.Server 实例,包括 HTTP、HTTPS 和 HTTP/2 Server 实例。
【The server.close() method was called when a net.Server was not
running. This applies to all instances of net.Server, including HTTP, HTTPS,
and HTTP/2 Server instances.】
ERR_SINGLE_EXECUTABLE_APPLICATION_ASSET_NOT_FOUND#>
一个密钥被传递给单一可执行应用的 API 用以识别资源,但未找到匹配项。
【A key was passed to single executable application APIs to identify an asset, but no match could be found.】
ERR_SOCKET_ALREADY_BOUND#>
试图绑定已经绑定的套接字。
【An attempt was made to bind a socket that has already been bound.】
ERR_SOCKET_BAD_BUFFER_SIZE#>
在 dgram.createSocket() 中,为 recvBufferSize 或 sendBufferSize 选项传递了无效(负数)的大小。
【An invalid (negative) size was passed for either the recvBufferSize or
sendBufferSize options in dgram.createSocket().】
ERR_SOCKET_BAD_PORT#>
期望端口 >= 0 且 < 65536 的 API 函数收到无效值。
【An API function expecting a port >= 0 and < 65536 received an invalid value.】
ERR_SOCKET_BAD_TYPE#>
一个期望接收套接字类型(udp4 或 udp6)的 API 函数收到了无效的值。
【An API function expecting a socket type (udp4 or udp6) received an invalid
value.】
ERR_SOCKET_BUFFER_SIZE#>
在使用 dgram.createSocket() 时,接收或发送缓冲区的大小无法确定。
【While using dgram.createSocket(), the size of the receive or send Buffer
could not be determined.】
ERR_SOCKET_CLOSED#>
试图在已经关闭的套接字上进行操作。
【An attempt was made to operate on an already closed socket.】
ERR_SOCKET_CLOSED_BEFORE_CONNECTION#>
在连接套接字上调用 net.Socket.write() 时,如果在建立连接之前套接字已关闭。
【When calling net.Socket.write() on a connecting socket and the socket was
closed before the connection was established.】
ERR_SOCKET_CONNECTION_TIMEOUT#>
在使用地址族自动选择算法时,套接字无法在允许的超时时间内连接到 DNS 返回的任何地址。
【The socket was unable to connect to any address returned by the DNS within the allowed timeout when using the family autoselection algorithm.】
ERR_SOCKET_DGRAM_IS_CONNECTED#>
在已连接的套接字上进行了 dgram.connect() 调用。
【A dgram.connect() call was made on an already connected socket.】
ERR_SOCKET_DGRAM_NOT_CONNECTED#>
在已断开的套接字上进行了 dgram.disconnect() 或 dgram.remoteAddress() 调用。
【A dgram.disconnect() or dgram.remoteAddress() call was made on a
disconnected socket.】
ERR_SOCKET_DGRAM_NOT_RUNNING#>
进行了调用,并且 UDP 子系统没有运行。
【A call was made and the UDP subsystem was not running.】
ERR_SOURCE_MAP_CORRUPT#>
无法解析源映射,因为它不存在或已损坏。
【The source map could not be parsed because it does not exist, or is corrupt.】
ERR_SOURCE_MAP_MISSING_SOURCE#>
未找到从源映射导入的文件。
【A file imported from a source map was not found.】
ERR_SQLITE_ERROR#>
来自 SQLite 的错误。
【An error was returned from SQLite.】
ERR_SRI_PARSE#>
提供了用于子资源完整性检查的字符串,但无法解析。请查看 子资源完整性规范 以检查完整性属性的格式。
【A string was provided for a Subresource Integrity check, but was unable to be parsed. Check the format of integrity attributes by looking at the Subresource Integrity specification.】
ERR_STREAM_ALREADY_FINISHED#>
调用了无法完成的流方法,因为流已经结束。
【A stream method was called that cannot complete because the stream was finished.】
ERR_STREAM_CANNOT_PIPE#>
尝试在 Writable 流上调用 stream.pipe()。
【An attempt was made to call stream.pipe() on a Writable stream.】
ERR_STREAM_DESTROYED#>
调用了一个流方法,但由于使用 stream.destroy() 销毁了流,该方法无法完成。
【A stream method was called that cannot complete because the stream was
destroyed using stream.destroy().】
ERR_STREAM_NULL_VALUES#>
尝试使用 null 块调用 stream.write()。
【An attempt was made to call stream.write() with a null chunk.】
ERR_STREAM_PREMATURE_CLOSE#>
stream.finished() 和 stream.pipeline() 返回的错误,当流或管道非正常结束且没有明确错误时出现。
【An error returned by stream.finished() and stream.pipeline(), when a stream
or a pipeline ends non gracefully with no explicit error.】
ERR_STREAM_PUSH_AFTER_EOF#>
在向流中推送了 null(EOF)之后,尝试调用 stream.push()。
【An attempt was made to call stream.push() after a null(EOF) had been
pushed to the stream.】
ERR_STREAM_UNSHIFT_AFTER_END_EVENT#>
在 'end' 事件触发后尝试调用 stream.unshift()。
【An attempt was made to call stream.unshift() after the 'end' event was
emitted.】
ERR_STREAM_WRAP#>
如果在 Socket 上设置了字符串解码器,或者解码器处于 objectMode,则可防止中止。
【Prevents an abort if a string decoder was set on the Socket or if the decoder
is in objectMode.】
const Socket = require('node:net').Socket;
const instance = new Socket();
instance.setEncoding('utf8');
ERR_STREAM_WRITE_AFTER_END#>
在调用 stream.end() 之后尝试调用 stream.write()。
【An attempt was made to call stream.write() after stream.end() has been
called.】
ERR_STRING_TOO_LONG#>
已尝试创建一个超过允许最大长度的字符串。
【An attempt has been made to create a string longer than the maximum allowed length.】
ERR_SYNTHETIC#>
一个用于捕获调用堆栈以进行诊断报告的人为错误对象。
【An artificial error object used to capture the call stack for diagnostic reports.】
ERR_SYSTEM_ERROR#>
Node.js 进程中发生了未指明或非特定的系统错误。错误对象将具有一个 err.info 属性,其中包含更多详细信息。
【An unspecified or non-specific system error has occurred within the Node.js
process. The error object will have an err.info object property with
additional details.】
ERR_TEST_FAILURE#>
此错误表示测试失败。关于失败的更多信息可以通过 cause 属性获得。failureType 属性指定了测试失败时正在执行的操作。
【This error represents a failed test. Additional information about the failure
is available via the cause property. The failureType property specifies
what the test was doing when the failure occurred.】
ERR_TLS_ALPN_CALLBACK_INVALID_RESULT#>
当 ALPNCallback 返回的值不在客户端提供的 ALPN 协议列表中时,会抛出此错误。
【This error is thrown when an ALPNCallback returns a value that is not in the
list of ALPN protocols offered by the client.】
ERR_TLS_ALPN_CALLBACK_WITH_PROTOCOLS#>
当在创建 TLSServer 时,如果 TLS 选项同时包含 ALPNProtocols 和 ALPNCallback,就会抛出此错误。这些选项是互斥的。
【This error is thrown when creating a TLSServer if the TLS options include
both ALPNProtocols and ALPNCallback. These options are mutually exclusive.】
ERR_TLS_CERT_ALTNAME_FORMAT#>
如果用户提供的 subjectaltname 属性违反编码规则,checkServerIdentity 会抛出此错误。由 Node.js 本身生成的证书对象总是符合编码规则的,永远不会引发此错误。
【This error is thrown by checkServerIdentity if a user-supplied
subjectaltname property violates encoding rules. Certificate objects produced
by Node.js itself always comply with encoding rules and will never cause
this error.】
ERR_TLS_CERT_ALTNAME_INVALID#>
在使用 TLS 时,对等方的主机名/IP 与其证书中的任何 subjectAltNames 都不匹配。
【While using TLS, the host name/IP of the peer did not match any of the
subjectAltNames in its certificate.】
ERR_TLS_DH_PARAM_SIZE#>
在使用 TLS 时,提供给 Diffie-Hellman(DH)密钥协商协议的参数过小。默认情况下,为了避免漏洞,密钥长度必须大于或等于 1024 位,尽管强烈建议使用 2048 位或更长的密钥以获得更高的安全性。
【While using TLS, the parameter offered for the Diffie-Hellman (DH)
key-agreement protocol is too small. By default, the key length must be greater
than or equal to 1024 bits to avoid vulnerabilities, even though it is strongly
recommended to use 2048 bits or larger for stronger security.】
ERR_TLS_HANDSHAKE_TIMEOUT#>
TLS/SSL 握手超时。在这种情况下,服务器也必须中止连接。
【A TLS/SSL handshake timed out. In this case, the server must also abort the connection.】
ERR_TLS_INVALID_CONTEXT#>
上下文必须是 SecureContext。
【The context must be a SecureContext.】
ERR_TLS_INVALID_PROTOCOL_METHOD#>
指定的 secureProtocol 方法无效。它要么未知,要么因不安全而被禁用。
【The specified secureProtocol method is invalid. It is either unknown, or
disabled because it is insecure.】
ERR_TLS_INVALID_PROTOCOL_VERSION#>
有效的 TLS 协议版本为 'TLSv1'、'TLSv1.1' 或 'TLSv1.2'。
【Valid TLS protocol versions are 'TLSv1', 'TLSv1.1', or 'TLSv1.2'.】
ERR_TLS_INVALID_STATE#>
TLS 套接字必须已连接并安全建立。请确保在继续操作之前触发 'secure' 事件。
【The TLS socket must be connected and securely established. Ensure the 'secure' event is emitted before continuing.】
ERR_TLS_PROTOCOL_VERSION_CONFLICT#>
尝试设置 TLS 协议的 minVersion 或 maxVersion 会与明确设置 secureProtocol 冲突。请使用其中一种机制。
【Attempting to set a TLS protocol minVersion or maxVersion conflicts with an
attempt to set the secureProtocol explicitly. Use one mechanism or the other.】
ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED#>
设置 PSK 身份提示失败。提示可能太长。
【Failed to set PSK identity hint. Hint may be too long.】
ERR_TLS_RENEGOTIATION_DISABLED#>
尝试在已禁用重新协商的套接字实例上重新协商 TLS。
【An attempt was made to renegotiate TLS on a socket instance with renegotiation disabled.】
ERR_TLS_REQUIRED_SERVER_NAME#>
在使用 TLS 时,调用 server.addContext() 方法时未在第一个参数中提供主机名。
【While using TLS, the server.addContext() method was called without providing
a host name in the first parameter.】
ERR_TLS_SESSION_ATTACK#>
检测到过多的 TLS 重新协商,这可能成为拒绝服务攻击的潜在途径。
【An excessive amount of TLS renegotiations is detected, which is a potential vector for denial-of-service attacks.】
ERR_TLS_SNI_FROM_SERVER#>
尝试从 TLS 服务器端套接字发送服务器名称指示(SNI),这仅对客户端有效。
【An attempt was made to issue Server Name Indication from a TLS server-side socket, which is only valid from a client.】
ERR_TRACE_EVENTS_CATEGORY_REQUIRED#>
trace_events.createTracing() 方法至少需要一个跟踪事件类别。
【The trace_events.createTracing() method requires at least one trace event
category.】
ERR_TRACE_EVENTS_UNAVAILABLE#>
无法加载 node:trace_events 模块,因为 Node.js 是使用 --without-v8-platform 标志编译的。
【The node:trace_events module could not be loaded because Node.js was compiled
with the --without-v8-platform flag.】
ERR_TRAILING_JUNK_AFTER_STREAM_END#>
在压缩流结束后发现多余的数据。当在压缩流结束后(例如在 zlib 或 gzip 解压缩中)检测到额外的、意外的数据时,会抛出此错误。
【Trailing junk found after the end of the compressed stream. This error is thrown when extra, unexpected data is detected after the end of a compressed stream (for example, in zlib or gzip decompression).】
ERR_TRANSFORM_ALREADY_TRANSFORMING#>
Transform 流在仍然转换时就已结束。
【A Transform stream finished while it was still transforming.】
ERR_TRANSFORM_WITH_LENGTH_0#>
Transform 流在写入缓冲区仍有数据时已完成。
【A Transform stream finished with data still in the write buffer.】
ERR_TTY_INIT_FAILED#>
由于系统错误,终端的初始化失败。
【The initialization of a TTY failed due to a system error.】
ERR_UNAVAILABLE_DURING_EXIT#>
函数在不应在 process.on('exit') 处理程序中调用的 process.on('exit') 处理程序内被调用。
【Function was called within a process.on('exit') handler that shouldn't be
called within process.on('exit') handler.】
ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET#>
process.setUncaughtExceptionCaptureCallback() 被调用了两次,而没有先将回调重置为 null。
此错误旨在防止意外覆盖从其他模块注册的回调。
【This error is designed to prevent accidentally overwriting a callback registered from another module.】
ERR_UNESCAPED_CHARACTERS#>
收到包含未转义字符的字符串。
【A string that contained unescaped characters was received.】
ERR_UNHANDLED_ERROR#>
发生未处理的错误(例如,当 EventEmitter 触发 'error' 事件但未注册 'error' 处理程序时)。
【An unhandled error occurred (for instance, when an 'error' event is emitted
by an EventEmitter but an 'error' handler is not registered).】
ERR_UNKNOWN_BUILTIN_MODULE#>
用于识别一种特定的 Node.js 内部错误,这种错误通常不应由用户代码触发。此类错误的出现表明 Node.js 二进制文件本身存在内部错误。
【Used to identify a specific kind of internal Node.js error that should not typically be triggered by user code. Instances of this error point to an internal bug within the Node.js binary itself.】
ERR_UNKNOWN_CREDENTIAL#>
传入了不存在的 Unix 群组或用户标识符。
【A Unix group or user identifier that does not exist was passed.】
ERR_UNKNOWN_ENCODING#>
传给 API 的编码选项无效或未知。
【An invalid or unknown encoding option was passed to an API.】
ERR_UNKNOWN_FILE_EXTENSION#>
尝试加载具有未知或不支持的文件扩展名的模块。
【An attempt was made to load a module with an unknown or unsupported file extension.】
ERR_UNKNOWN_MODULE_FORMAT#>
试图加载格式未知或不受支持的模块。
【An attempt was made to load a module with an unknown or unsupported format.】
ERR_UNKNOWN_SIGNAL#>
向期望有效信号(例如 subprocess.kill())的 API 传递了无效或未知的进程信号。
【An invalid or unknown process signal was passed to an API expecting a valid
signal (such as subprocess.kill()).】
ERR_UNSUPPORTED_DIR_IMPORT#>
import 目录 URL 不被支持。相反,请在 package.json 文件的 "exports" 字段中使用 使用包名进行自我引用 和 定义自定义子路径。
import './'; // unsupported
import './index.js'; // supported
import 'package-name'; // supported
ERR_UNSUPPORTED_ESM_URL_SCHEME#>
不支持使用除 file 和 data 之外的 URL 方案的 import。
ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING#>
不支持对 node_modules 目录下的文件进行类型剥离。
【Type stripping is not supported for files descendent of a node_modules directory.】
ERR_UNSUPPORTED_RESOLVE_REQUEST#>
尝试解析无效的模块引用时出现问题。这可能发生在导入或调用 import.meta.resolve() 时出现以下情况:
【An attempt was made to resolve an invalid module referrer. This can happen when
importing or calling import.meta.resolve() with either:】
try {
// Trying to import the package 'bare-specifier' from a `data:` URL module:
await import('data:text/javascript,import "bare-specifier"');
} catch (e) {
console.log(e.code); // ERR_UNSUPPORTED_RESOLVE_REQUEST
}
ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX#>
所提供的 TypeScript 语法不被支持。 当使用需要通过 类型剥离 进行转换的 TypeScript 语法时,可能会发生这种情况。
【The provided TypeScript syntax is unsupported. This could happen when using TypeScript syntax that requires transformation with type-stripping.】
ERR_USE_AFTER_CLOSE#>
试图使用已经关闭的东西。
【An attempt was made to use something that was already closed.】
ERR_VALID_PERFORMANCE_ENTRY_TYPE#>
在使用性能计时 API (perf_hooks) 时,未找到有效的性能条目类型。
【While using the Performance Timing API (perf_hooks), no valid performance
entry types are found.】
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING#>
未指定动态导入回调。
【A dynamic import callback was not specified.】
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG#>
在未使用 --experimental-vm-modules 的情况下调用了动态导入回调。
【A dynamic import callback was invoked without --experimental-vm-modules.】
ERR_VM_MODULE_ALREADY_LINKED#>
尝试链接的模块不符合链接条件,原因可能是以下之一:
【The module attempted to be linked is not eligible for linking, because of one of the following reasons:】
- 它已经被关联(
linkingStatus为'linked') - 正在链接(
linkingStatus为'linking') - 此模块的链接失败(
linkingStatus为'errored')
ERR_VM_MODULE_CACHED_DATA_REJECTED#>
传递给模块构造函数的 cachedData 选项无效。
【The cachedData option passed to a module constructor is invalid.】
ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA#>
不能为已经评估过的模块创建缓存数据。
【Cached data cannot be created for modules which have already been evaluated.】
ERR_VM_MODULE_DIFFERENT_CONTEXT#>
从链接器函数返回的模块与父模块来自不同的上下文。链接的模块必须共享相同的上下文。
【The module being returned from the linker function is from a different context than the parent module. Linked modules must share the same context.】
ERR_VM_MODULE_LINK_FAILURE#>
由于失败,模块无法链接。
【The module was unable to be linked due to a failure.】
ERR_VM_MODULE_NOT_MODULE#>
链接承诺的已实现值不是 vm.Module 对象。
【The fulfilled value of a linking promise is not a vm.Module object.】
ERR_VM_MODULE_STATUS#>
当前模块的状态不允许执行此操作。错误的具体含义取决于具体功能。
【The current module's status does not allow for this operation. The specific meaning of the error depends on the specific function.】
ERR_WASI_ALREADY_STARTED#>
WASI 实例已经启动。
【The WASI instance has already started.】
ERR_WASI_NOT_STARTED#>
WASI 实例尚未启动。
【The WASI instance has not been started.】
ERR_WEBASSEMBLY_RESPONSE#>
传递给 WebAssembly.compileStreaming 或 WebAssembly.instantiateStreaming 的 Response 不是有效的 WebAssembly 响应。
【The Response that has been passed to WebAssembly.compileStreaming or to
WebAssembly.instantiateStreaming is not a valid WebAssembly response.】
ERR_WORKER_INIT_FAILED#>
Worker 初始化失败。
【The Worker initialization failed.】
ERR_WORKER_INVALID_EXEC_ARGV#>
传递给 Worker 构造函数的 execArgv 选项包含无效标志。
【The execArgv option passed to the Worker constructor contains
invalid flags.】
ERR_WORKER_MESSAGING_ERRORED#>
目标线程在处理通过 postMessageToThread() 发送的消息时抛出了错误。
【The destination thread threw an error while processing a message sent via postMessageToThread().】
ERR_WORKER_MESSAGING_FAILED#>
postMessageToThread() 中请求的线程无效或没有 workerMessage 监听器。
【The thread requested in postMessageToThread() is invalid or has no workerMessage listener.】
ERR_WORKER_MESSAGING_SAME_THREAD#>
postMessageToThread() 中请求的线程 ID 是当前线程 ID。
【The thread id requested in postMessageToThread() is the current thread id.】
ERR_WORKER_MESSAGING_TIMEOUT#>
通过 postMessageToThread() 发送消息超时。
【Sending a message via postMessageToThread() timed out.】
ERR_WORKER_NOT_RUNNING#>
操作失败,因为 Worker 实例当前未运行。
【An operation failed because the Worker instance is not currently running.】
ERR_WORKER_OUT_OF_MEMORY#>
Worker 实例终止,因为它达到了内存限制。
【The Worker instance terminated because it reached its memory limit.】
ERR_WORKER_PATH#>
worker 的主脚本的路径既不是绝对路径,也不是以 ./ 或 ../ 开头的相对路径。
【The path for the main script of a worker is neither an absolute path
nor a relative path starting with ./ or ../.】
ERR_WORKER_UNSERIALIZABLE_ERROR#>
从工作线程序列化未捕获异常的所有尝试都失败了。
【All attempts at serializing an uncaught exception from a worker thread failed.】
ERR_WORKER_UNSUPPORTED_OPERATION#>
工作线程不支持请求的功能。
【The requested functionality is not supported in worker threads.】
ERR_ZLIB_INITIALIZATION_FAILED#>
由于配置错误,创建 zlib 对象失败。
【Creation of a zlib object failed due to incorrect configuration.】
ERR_ZSTD_INVALID_PARAM#>
在构建 Zstd 流期间传递了无效的参数键。
【An invalid parameter key was passed during construction of a Zstd stream.】
HPE_CHUNK_EXTENSIONS_OVERFLOW#>
接收到的块扩展数据过多。为了防止恶意或配置错误的客户端,如果接收到的数据超过 16 KiB,则会发出带有此代码的 Error。
【Too much data was received for a chunk extensions. In order to protect against
malicious or malconfigured clients, if more than 16 KiB of data is received
then an Error with this code will be emitted.】
HPE_HEADER_OVERFLOW#>
收到的 HTTP 头数据过多。为了防止恶意或配置错误的客户端,如果接收到的 HTTP 头数据超过 maxHeaderSize,HTTP 解析将中止,并且不会创建请求或响应对象,同时会发出带有此代码的 Error。
【Too much HTTP header data was received. In order to protect against malicious or
malconfigured clients, if more than maxHeaderSize of HTTP header data is received then
HTTP parsing will abort without a request or response object being created, and
an Error with this code will be emitted.】
HPE_UNEXPECTED_CONTENT_LENGTH#>
服务器同时发送了 Content-Length 头和 Transfer-Encoding: chunked。
【Server is sending both a Content-Length header and Transfer-Encoding: chunked.】
Transfer-Encoding: chunked 允许服务器为动态生成的内容保持 HTTP 持久连接。在这种情况下,不能使用 Content-Length HTTP 头。
使用 Content-Length 或 Transfer-Encoding: chunked。
【Use Content-Length or Transfer-Encoding: chunked.】
MODULE_NOT_FOUND#>
在尝试进行 require() 操作或加载程序入口点时,CommonJS 模块加载器无法解析模块文件。
【A module file could not be resolved by the CommonJS modules loader while
attempting a require() operation or when loading the program entry point.】
旧版 Node.js 错误代码#>
【Legacy Node.js error codes】
ERR_CANNOT_TRANSFER_OBJECT#>
传递给 postMessage() 的值包含不支持传输的对象。
【The value passed to postMessage() contained an object that is not supported
for transferring.】
ERR_CPU_USAGE#>
无法处理来自 process.cpuUsage 的本地调用。
【The native call from process.cpuUsage could not be processed.】
ERR_CRYPTO_HASH_DIGEST_NO_UTF16#>
UTF-16 编码在 hash.digest() 中被使用。虽然 hash.digest() 方法确实允许传入 encoding 参数,从而使该方法返回字符串而不是 Buffer,但 UTF-16 编码(例如 ucs 或 utf16le)是不被支持的。
【The UTF-16 encoding was used with hash.digest(). While the
hash.digest() method does allow an encoding argument to be passed in,
causing the method to return a string rather than a Buffer, the UTF-16
encoding (e.g. ucs or utf16le) is not supported.】
ERR_HTTP2_FRAME_ERROR#>
当在 HTTP/2 会话上发送单个帧失败时使用。
【Used when a failure occurs sending an individual frame on the HTTP/2 session.】
ERR_HTTP2_HEADERS_OBJECT#>
在需要 HTTP/2 标头对象时使用。
【Used when an HTTP/2 Headers Object is expected.】
ERR_HTTP2_HEADER_REQUIRED#>
当 HTTP/2 消息中缺少所需的标头时使用。
【Used when a required header is missing in an HTTP/2 message.】
ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND#>
HTTP/2 信息头只能在调用 Http2Stream.prototype.respond() 方法之前发送。
【HTTP/2 informational headers must only be sent prior to calling the
Http2Stream.prototype.respond() method.】
ERR_HTTP2_STREAM_CLOSED#>
当对已关闭的 HTTP/2 流执行操作时使用。
【Used when an action has been performed on an HTTP/2 Stream that has already been closed.】
ERR_HTTP_INVALID_CHAR#>
当在HTTP响应状态消息(原因短语)中发现无效字符时使用
【Used when an invalid character is found in an HTTP response status message (reason phrase).】
ERR_IMPORT_ASSERTION_TYPE_FAILED#>
导入断言失败,阻止导入指定的模块。
【An import assertion has failed, preventing the specified module to be imported.】
ERR_IMPORT_ASSERTION_TYPE_MISSING#>
缺少导入断言,阻止导入指定的模块。
【An import assertion is missing, preventing the specified module to be imported.】
ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED#>
此版本的 Node.js 不支持导入属性。
【An import attribute is not supported by this version of Node.js.】
ERR_INDEX_OUT_OF_RANGE#>
给定的索引超出了可接受的范围(例如负偏移量)。
【A given index was out of the accepted range (e.g. negative offsets).】
ERR_INVALID_OPT_VALUE#>
在选项对象中传入了无效或意外的值。
【An invalid or unexpected value was passed in an options object.】
ERR_INVALID_OPT_VALUE_ENCODING#>
传入了无效或未知的文件编码。
【An invalid or unknown file encoding was passed.】
ERR_INVALID_PERFORMANCE_MARK#>
在使用性能计时 API (perf_hooks) 时,性能标记是无效的。
【While using the Performance Timing API (perf_hooks), a performance mark is
invalid.】
ERR_INVALID_TRANSFER_OBJECT#>
向 postMessage() 传递了无效的传输对象。
【An invalid transfer object was passed to postMessage().】
ERR_MANIFEST_ASSERT_INTEGRITY#>
尝试加载资源时失败,该资源与策略清单中定义的完整性不符。有关策略清单的更多信息,请参阅文档。
【An attempt was made to load a resource, but the resource did not match the integrity defined by the policy manifest. See the documentation for policy manifests for more information.】
ERR_MANIFEST_DEPENDENCY_MISSING#>
尝试加载一个资源,但该资源并未被列为尝试加载它的位置的依赖。有关更多信息,请参阅策略清单的文档。
【An attempt was made to load a resource, but the resource was not listed as a dependency from the location that attempted to load it. See the documentation for policy manifests for more information.】
ERR_MANIFEST_INTEGRITY_MISMATCH#>
尝试加载策略清单时失败,但清单中某个资源有多个条目且彼此不匹配。请更新清单条目以使其匹配,以解决此错误。有关策略清单的更多信息,请参阅文档。
【An attempt was made to load a policy manifest, but the manifest had multiple entries for a resource which did not match each other. Update the manifest entries to match in order to resolve this error. See the documentation for policy manifests for more information.】
ERR_MANIFEST_INVALID_RESOURCE_FIELD#>
策略清单资源的某个字段值无效。请更新清单条目以匹配,以解决此错误。有关策略清单的更多信息,请参阅文档。
【A policy manifest resource had an invalid value for one of its fields. Update the manifest entry to match in order to resolve this error. See the documentation for policy manifests for more information.】
ERR_MANIFEST_INVALID_SPECIFIER#>
策略清单资源的某个依赖映射值无效。请更新清单条目以匹配以解决此错误。有关策略清单的更多信息,请参阅文档。
【A policy manifest resource had an invalid value for one of its dependency mappings. Update the manifest entry to match to resolve this error. See the documentation for policy manifests for more information.】
ERR_MANIFEST_PARSE_POLICY#>
尝试加载策略清单时,无法解析清单。有关策略清单的更多信息,请参阅文档。
【An attempt was made to load a policy manifest, but the manifest was unable to be parsed. See the documentation for policy manifests for more information.】
ERR_MANIFEST_TDZ#>
尝试从策略清单中读取,但清单尚未初始化。这很可能是 Node.js 中的一个错误。
【An attempt was made to read from a policy manifest, but the manifest initialization has not yet taken place. This is likely a bug in Node.js.】
ERR_MANIFEST_UNKNOWN_ONERROR#>
策略清单已加载,但其“onerror”行为存在未知值。有关策略清单的详细信息,请参阅文档。
【A policy manifest was loaded, but had an unknown value for its "onerror" behavior. See the documentation for policy manifests for more information.】
ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST#>
在 Node.js v15.0.0 中,这个错误代码被 ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST 取代,因为它已不再准确,因为现在还存在其他类型的可传输对象。
【This error code was replaced by ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST
in Node.js v15.0.0, because it is no longer accurate as other types of
transferable objects also exist now.】
ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST#>
一个需要在 transferList 参数中明确列出的对象存在于传递给 postMessage() 调用的对象中,但在该调用的 transferList 中没有提供。通常,这个对象是一个 MessagePort。
【An object that needs to be explicitly listed in the transferList argument
is in the object passed to a postMessage() call, but is not provided
in the transferList for that call. Usually, this is a MessagePort.】
在 Node.js v15.0.0 之前的版本中,这里使用的错误代码是 ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST。然而,可传输对象类型的集合已经扩展,覆盖的类型比 MessagePort 更多。
【In Node.js versions prior to v15.0.0, the error code being used here was
ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST. However, the set of
transferable object types has been expanded to cover more types than
MessagePort.】
ERR_NAPI_CONS_PROTOTYPE_OBJECT#>
当 Constructor.prototype 不是对象时,由 Node-API 使用。
【Used by the Node-API when Constructor.prototype is not an object.】
ERR_NAPI_TSFN_START_IDLE_LOOP#>
在主线程中,值会从与线程安全函数关联的队列中移除,通常是在一个空闲循环中。此错误表示在尝试启动循环时发生了错误。
【On the main thread, values are removed from the queue associated with the thread-safe function in an idle loop. This error indicates that an error has occurred when attempting to start the loop.】
ERR_NAPI_TSFN_STOP_IDLE_LOOP#>
一旦队列中没有剩余的项目,空闲循环必须被挂起。此错误表示空闲循环未能停止。
【Once no more items are left in the queue, the idle loop must be suspended. This error indicates that the idle loop has failed to stop.】
ERR_NO_LONGER_SUPPORTED#>
以不受支持的方式调用了 Node.js API,例如 Buffer.write(string, encoding, offset[, length])。
【A Node.js API was called in an unsupported manner, such as
Buffer.write(string, encoding, offset[, length]).】
ERR_OUTOFMEMORY#>
通常用于表示某个操作导致了内存不足的情况。
【Used generically to identify that an operation caused an out of memory condition.】
ERR_PARSE_HISTORY_DATA#>
node:repl 模块无法解析 REPL 历史文件中的数据。
【The node:repl module was unable to parse data from the REPL history file.】
ERR_SOCKET_CANNOT_SEND#>
无法在套接字上发送数据。
【Data could not be sent on a socket.】
ERR_STDERR_CLOSE#>
尝试关闭 process.stderr 流。根据设计,Node.js 不允许用户代码关闭 stdout 或 stderr 流。
【An attempt was made to close the process.stderr stream. By design, Node.js
does not allow stdout or stderr streams to be closed by user code.】
ERR_STDOUT_CLOSE#>
尝试关闭 process.stdout 流。根据设计,Node.js 不允许用户代码关闭 stdout 或 stderr 流。
【An attempt was made to close the process.stdout stream. By design, Node.js
does not allow stdout or stderr streams to be closed by user code.】
ERR_STREAM_READ_NOT_IMPLEMENTED#>
当尝试使用尚未实现 readable._read() 的可读流时使用。
【Used when an attempt is made to use a readable stream that has not implemented
readable._read().】
ERR_TAP_LEXER_ERROR#>
代表失败的词法分析器状态的错误。
【An error representing a failing lexer state.】
ERR_TAP_PARSER_ERROR#>
表示解析器失效状态的错误。关于 导致错误的令牌通过“cause”属性获得。
【An error representing a failing parser state. Additional information about
the token causing the error is available via the cause property.】
ERR_TAP_VALIDATION_ERROR#>
此错误表示 TAP 验证失败。
【This error represents a failed TAP validation.】
ERR_TLS_RENEGOTIATION_FAILED#>
当 TLS 重新协商请求以非特定方式失败时使用。
【Used when a TLS renegotiation request has failed in a non-specific way.】
ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER#>
在序列化过程中遇到了一个内存不受 JavaScript 引擎或 Node.js 管理的 SharedArrayBuffer。这样的 SharedArrayBuffer 无法被序列化。
【A SharedArrayBuffer whose memory is not managed by the JavaScript engine
or by Node.js was encountered during serialization. Such a SharedArrayBuffer
cannot be serialized.】
这只能发生在本地插件以“外部化”模式创建 SharedArrayBuffer 时,或者将已有的 SharedArrayBuffer 置于外部化模式时。
【This can only happen when native addons create SharedArrayBuffers in
"externalized" mode, or put existing SharedArrayBuffer into externalized mode.】
ERR_UNKNOWN_STDIN_TYPE#>
尝试使用未知的 stdin 文件类型启动 Node.js 进程。此错误通常表示 Node.js 本身存在缺陷,尽管用户代码也有可能触发该错误。
【An attempt was made to launch a Node.js process with an unknown stdin file
type. This error is usually an indication of a bug within Node.js itself,
although it is possible for user code to trigger it.】
ERR_UNKNOWN_STREAM_TYPE#>
尝试启动一个具有未知 stdout 或 stderr 文件类型的 Node.js 进程。此错误通常表示 Node.js 本身存在漏洞,尽管用户代码也有可能触发它。
【An attempt was made to launch a Node.js process with an unknown stdout or
stderr file type. This error is usually an indication of a bug within Node.js
itself, although it is possible for user code to trigger it.】
ERR_V8BREAKITERATOR#>
使用了 V8 BreakIterator API,但未安装完整的 ICU 数据集。
【The V8 BreakIterator API was used but the full ICU data set is not installed.】
ERR_VALUE_OUT_OF_RANGE#>
当给定值超出可接受范围时使用。
【Used when a given value is out of the accepted range.】
ERR_VM_MODULE_LINKING_ERRORED#>
链接器函数返回链接失败的模块。
【The linker function returned a module for which linking has failed.】
ERR_VM_MODULE_NOT_LINKED#>
模块必须在实例化前成功链接。
【The module must be successfully linked before instantiation.】
ERR_WORKER_UNSUPPORTED_EXTENSION#>
用于 worker 主脚本的路径名具有未知的文件扩展名。
【The pathname used for the main script of a worker has an unknown file extension.】
ERR_ZLIB_BINDING_CLOSED#>
当尝试在 zlib 对象已经关闭后使用它时,会使用此项。
【Used when an attempt is made to use a zlib object after it has already been
closed.】
OpenSSL 错误代码#>
【OpenSSL Error Codes】
时间有效性错误#>
【Time Validity Errors】
CERT_NOT_YET_VALID#>
证书尚未生效:notBefore 日期晚于当前时间。
【The certificate is not yet valid: the notBefore date is after the current time.】
CERT_HAS_EXPIRED#>
证书已过期:notAfter 日期早于当前时间。
【The certificate has expired: the notAfter date is before the current time.】
CRL_NOT_YET_VALID#>
证书吊销列表 (CRL) 具有未来的颁发日期。
【The certificate revocation list (CRL) has a future issue date.】
CRL_HAS_EXPIRED#>
证书吊销列表 (CRL) 已过期。
【The certificate revocation list (CRL) has expired.】
CERT_REVOKED#>
该证书已被吊销;它在证书吊销列表(CRL)中。
【The certificate has been revoked; it is on a certificate revocation list (CRL).】
信任或链相关错误#>
【Trust or Chain Related Errors】
UNABLE_TO_GET_ISSUER_CERT#>
无法找到所查询证书的颁发者证书。这通常意味着受信任证书列表不完整。
【The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete.】
UNABLE_TO_GET_ISSUER_CERT_LOCALLY#>
证书的颁发者未知。如果颁发者未包含在受信任的证书列表中,就会出现这种情况。
【The certificate’s issuer is not known. This is the case if the issuer is not included in the trusted certificate list.】
DEPTH_ZERO_SELF_SIGNED_CERT#>
通过的证书是自签名的,并且在受信任的证书列表中找不到相同的证书。
【The passed certificate is self-signed and the same certificate cannot be found in the list of trusted certificates.】
SELF_SIGNED_CERT_IN_CHAIN#>
证书的颁发者未知。如果颁发者未包含在受信任的证书列表中,就会出现这种情况。
【The certificate’s issuer is not known. This is the case if the issuer is not included in the trusted certificate list.】
CERT_CHAIN_TOO_LONG#>
证书链长度大于最大深度。
【The certificate chain length is greater than the maximum depth.】
UNABLE_TO_GET_CRL#>
找不到证书引用的 CRL。
【The CRL reference by the certificate could not be found.】
UNABLE_TO_VERIFY_LEAF_SIGNATURE#>
无法验证任何签名,因为证书链中只包含一个证书,并且它不是自签名的。
【No signatures could be verified because the chain contains only one certificate and it is not self signed.】
CERT_UNTRUSTED#>
根证书颁发机构 (CA) 未被标记为指定用途的受信任机构。
【The root certificate authority (CA) is not marked as trusted for the specified purpose.】
基本扩展错误#>
【Basic Extension Errors】
INVALID_CA#>
CA 证书无效。要么它不是 CA,要么其扩展与所提供的用途不一致。
【A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose.】
PATH_LENGTH_EXCEEDED#>
已超出 basicConstraints 路径长度参数。
【The basicConstraints pathlength parameter has been exceeded.】
名称相关错误#>
【Name Related Errors】
HOSTNAME_MISMATCH#>
证书与提供的名称不匹配。
【Certificate does not match provided name.】
用法和政策错误#>
【Usage and Policy Errors】
INVALID_PURPOSE#>
提供的证书不能用于指定目的。
【The supplied certificate cannot be used for the specified purpose.】
CERT_REJECTED#>
根 CA 被标记为拒绝指定目的。
【The root CA is marked to reject the specified purpose.】
格式错误#>
【Formatting Errors】
CERT_SIGNATURE_FAILURE#>
证书签名无效。
【The signature of the certificate is invalid.】
CRL_SIGNATURE_FAILURE#>
证书吊销列表 (CRL) 的签名无效。
【The signature of the certificate revocation list (CRL) is invalid.】
ERROR_IN_CERT_NOT_BEFORE_FIELD#>
证书 notBefore 字段包含无效时间。
【The certificate notBefore field contains an invalid time.】
ERROR_IN_CERT_NOT_AFTER_FIELD#>
证书 notAfter 字段包含无效时间。
【The certificate notAfter field contains an invalid time.】
ERROR_IN_CRL_LAST_UPDATE_FIELD#>
CRL LastUpdate 字段包含无效时间。
【The CRL lastUpdate field contains an invalid time.】
ERROR_IN_CRL_NEXT_UPDATE_FIELD#>
CRL nextUpdate 字段包含无效时间。
【The CRL nextUpdate field contains an invalid time.】
UNABLE_TO_DECRYPT_CERT_SIGNATURE#>
无法解密证书签名。这意味着无法确定实际的签名值,而不是与预期值不匹配,这仅对 RSA 密钥有意义。
【The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys.】
UNABLE_TO_DECRYPT_CRL_SIGNATURE#>
无法解密证书吊销列表(CRL)签名:这意味着实际的签名值无法确定,而不是与预期值不匹配。
【The certificate revocation list (CRL) signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value.】
UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY#>
无法读取证书 SubjectPublicKeyInfo 中的公钥。
【The public key in the certificate SubjectPublicKeyInfo could not be read.】
其他 OpenSSL 错误#>
【Other OpenSSL Errors】
OUT_OF_MEM#>
尝试分配内存时发生错误。这种情况不应该发生。
【An error occurred trying to allocate memory. This should never happen.】