node.js错误连接ENOTSOCK

node.js错误连接ENOTSOCK,node.js,Node.js,当我运行node脚本时使用node.js时,我得到了这个错误,我不知道我在哪里出错 events.js:72 throw er; // Unhandled 'error' event ^ 错误:连接ENOTSOCK 在errnoException(net.js:904:11) 在Object.afterConnect[as oncomplete](net.js:895:19) 这是我用来连接服务器的脚本代码 var net = require('net');

当我运行node脚本时使用node.js时,我得到了这个错误,我不知道我在哪里出错

events.js:72
    throw er; // Unhandled 'error' event
          ^
错误:连接ENOTSOCK 在errnoException(net.js:904:11) 在Object.afterConnect[as oncomplete](net.js:895:19)

这是我用来连接服务器的脚本代码

    var net = require('net');
// createConnection
var connection = net.createConnection({port: 8181, host:'/path/to/local_host/',path:'/Applications/XAMPP/xamppfiles/htdocs'},
// connectListener callback
    function() {
        console.log('connection successful');
});
该方法仅接受path作为字符串参数,即unix套接字的路径

var connection = net.createConnection('/path/to/socket/', function(socket) {
        console.log('connection successful');
});

如果要连接到TCP套接字,请从options对象中删除路径。

谢谢你的回复Ben,我犯了一个愚蠢的错误我的节点服务器关闭了这是唯一的问题谢谢。