类:SyntaxError
- 扩展: <errors.Error>
表示程序不是有效的 JavaScript。这些错误只能作为代码评估的结果生成和传播。 eval
、 Function
、 require
或 vm 可能会导致代码评估。这些错误几乎总是表明程序损坏。
try {
require('node:vm').runInThisContext('binary ! isNotOk');
} catch (err) {
// 'err' will be a SyntaxError.
}
SyntaxError
实例在创建它们的上下文中是不可恢复的 - 它们可能只会被其他上下文捕获。
相关用法
- Node.js ServerHttp2Session.origin(...origins)用法及代码示例
- Node.js MySQL SUBSTRING()用法及代码示例
- Node.js Stream.pipeline()用法及代码示例
- Node.js Sign用法及代码示例
- Node.js ServerHttp2Session.altsvc(alt, originOrStream)用法及代码示例
- Node.js MySQL SUM()用法及代码示例
- Node.js ServerHttp2Stream http2stream.pushStream(headers[, options], callback)用法及代码示例
- Node.js http2.Http2ServerRequest request.url用法及代码示例
- Node.js request.socket用法及代码示例
- Node.js assert.notEqual(actual, expected[, message])用法及代码示例
- Node.js tlsSocket.authorized用法及代码示例
- Node.js zlib.deflateRaw()用法及代码示例
- Node.js http.IncomingMessage message.rawHeaders用法及代码示例
- Node.js Console用法及代码示例
- Node.js GM transparent()用法及代码示例
- Node.js URL.protocol用法及代码示例
- Node.js http.Agent.reuseSocket(socket, request)用法及代码示例
- Node.js fs.filehandle.datasync()用法及代码示例
- Node.js socket.bind()用法及代码示例
- Node.js v8.getHeapSpaceStatistics()用法及代码示例
- Node.js http2session.destroyed用法及代码示例
- Node.js http.ServerResponse response.statusCode用法及代码示例
- Node.js Buffer buf.writeBigUInt64BE(value[, offset])用法及代码示例
- Node.js Http2ServerResponse.finished用法及代码示例
- Node.js Http2Stream close用法及代码示例
注:本文由纯净天空筛选整理自nodejs.org大神的英文原创作品 SyntaxError。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。