gpt4 book ai didi

node.js - 语法错误: Unexpected reserved word sql-cli

转载 作者:太空宇宙 更新时间:2023-11-04 01:36:08 27 4
gpt4 key购买 nike

我尝试按照本指南在 Mac https://database.guide/how-to-install-sql-server-on-a-mac/ 中将 mssql 与 docker 一起使用,但在尝试连接到 SQL Server 时出现 SyntaxError: Unexpectedserved word error in /usr/local/lib/node_modules/sql-cli/lib/cli.js:21

错误:

/usr/local/lib/node_modules/sql-cli/lib/cli.js:21
class SqlCli {
^^^^^
SyntaxError: Unexpected reserved word
at Module._compile (module.js:439:25)
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/sql-cli/bin/mssql.js:1:76)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

代码:(不是我的)

...
class SqlCli {
constructor() {
this.db = new MSSQLDbService();
this.messages = new Messages();
this.options = new Options();
this.buffer = new Buffer();
}
...

我使用的是 Node 版本 0.10.35,因为这是我的项目正在使用的版本,我无法更改它。

最佳答案

我看了你发布的教程,它使用 npm 下载 SqlCli。

当您将类或文件命名为与node_modules中的包相同时,它将与 Node 包冲突并最终给您带来这个 fatal error ,

尝试将类和文件名更改为不同的内容,然后再次检查。

class DBCli {
constructor() {
this.db = new MSSQLDbService();
this.messages = new Messages();
this.options = new Options();
this.buffer = new Buffer();
}
}

关于node.js - 语法错误: Unexpected reserved word sql-cli,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54538252/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com