node 连接mssql 拿官方简单例子 在 vscode 调试出错

拿官方的简单例子
const sql = require('mssql');
async () => {

try {
    const pool = await sql.connect('mssql://username:password@localhost/database')
    const result = await sql.query`select * from mytable where id = ${value}`
    console.dir(result)
} catch (err) {
    // ... error checks
}

}
出错:

clipboard.png

阅读 2.5k
1 个回答

你的 node 版本太低,不支持 async function。你需要 node 8。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题