【问题标题】:Nodejs: SyntaxError Exception - "Unexpected token new" faced while trying to require ajv.jsNodejs:SyntaxError 异常 - 尝试要求 ajv.js 时面临“意外的新令牌”
【发布时间】:2017-10-25 05:58:06
【问题描述】:

尝试要求 Ajv 模块时发生异常。

var Ajv = require('C:/../node_modules/ajv/lib/ajv.js')

vm.js 中发生异常

function createScript(code, options) {
    return new Script(code, options);
}

Exception has occurred: SyntaxError
SyntaxError: Unexpected token new
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\myFile.js:1:73)

有什么建议可以纠正这个问题吗?

【问题讨论】:

    标签: node.js ajv


    【解决方案1】:

    这听起来可能很有趣,但我必须卸载并重新安装 ajv.js 才能使其正常工作。

    关于可能发生的事情的任何线索?

    【讨论】:

      猜你喜欢
      • 2018-02-02
      • 2015-10-27
      • 1970-01-01
      • 2017-09-05
      • 2015-11-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      • 1970-01-01
      相关资源
      最近更新 更多