连接套接字从testing中航行

我试图从摩卡testing风帆套接字连接。

var socketIOClient = require('socket.io-client'); var sailsIOClient = require('sails.io.js'); // Instantiate the socket client (`io`) // (for now, you must explicitly pass in the socket.io client when using this library from Node.js) var io = sailsIOClient(socketIOClient); // Set some options: // (you have to specify the host and port of the Sails backend when using this library from Node.js) io.sails.url = 'http://localhost:1337'; 

它给出了一个错误

未捕获的错误:提供的socket.io客户端(io)已经扩展到Sails套接字SDK实例(它有io.sails)。

难道我做错了什么? sails版本0.12.3,socket.io-client 1.4.6

你的问题是可能的,因为你已经安装了多个sails.io.js

你应该查看这行代码sails.io.js

检查你的代码