'TypeError: Object is not a function' when using tunnel-ssh

'TypeError: Object is not a function' when using tunnel-ssh

我正在 运行 为流行的 NPM 包 tunnel-ssh 教程中的基本示例。这是代码:

var tunnel = require('tunnel-ssh');
var config = {
    username:'root',
    password:'secret',
    host:'remote.mysql.server.com',
    port:3306
}

tunnel(config, function(e, sshTunnel){
    //Now, you should be able to connect to the tunnel via localhost:3336.
});

当然,我运行使用我自己的数据库的凭据来连接它。但是,当我 运行 时总是会出现此错误:

TypeError: object is not a function

有人知道发生了什么事吗?

var tunnel = require('tunnel-ssh');

var config = {username: 'vagrant',host: '192.168.33.2', port:3307, dstPort:3306 }

tunnel.tunnel(config, function(e, sshTunnel){});

我在 192.168.33.2 中添加了我的密钥,并将目标端口 3306 转发到我的本地端口 3307。

我是 运行 在 RPEL 节点版本 v0.12.4 上。它的工作。