我正在运行流行的NPM软件包tunnel-ssh的教程中的基本示例。这里是代码:使用tunnel-ssh时'TypeError:Object不是函数'
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
任何人都知道发生了什么事?
你在隧道回调中没有做任何事情吗? – Paul
@Paul我试着用一个简单的console.log语句在回调中运行它。仍然得到错误。 – frogbandit
你有没有尝试过从cli w/o使用软件包来做它?即ssh [email protected] -L 3306:localhost:3306?可能是因为错误的证书或者其他东西(比如,如果你想用mysql凭证登录,并且ssh用户有不同的凭证,或者mysql用户没有启用ssh),远程方拒绝连接。 – Paul