Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Ubuntu 12.04中的Socket.io错误_Node.js_Mongodb_Socket.io_Ubuntu 12.04 - Fatal编程技术网

Node.js Ubuntu 12.04中的Socket.io错误

Node.js Ubuntu 12.04中的Socket.io错误,node.js,mongodb,socket.io,ubuntu-12.04,Node.js,Mongodb,Socket.io,Ubuntu 12.04,我刚刚将node.js、npm和mongodb安装到新的Ubuntu 12.04服务器上。当我尝试打开我的站点时,我遇到以下错误: /home/proj/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:402 return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(pa

我刚刚将node.js、npm和mongodb安装到新的Ubuntu 12.04服务器上。当我尝试打开我的站点时,我遇到以下错误:

/home/proj/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:402
        return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(pa
                                         ^
TypeError: Object function Buffer(subject, encoding, offset) {
  if (!(this instanceof Buffer)) {
    return new Buffer(subject, encoding, offset);
  }

  var type;

  // Are we slicing?
  if (typeof offset === 'number') {
    this.length = coerce(encoding);
    this.parent = subject;
    this.offset = offset;
  } else {
    // Find the length
    switch (type = typeof subject) {
      case 'number':
        this.length = coerce(subject);
        break;

      case 'string':
        this.length = Buffer.byteLength(subject, encoding);
        break;

      case 'object': // Assume object is an array
        this.length = coerce(subject.length);
        break;

      default:
        throw new Error('First argument needs to be a number, ' +
                        'array or string.');
    }

    if (this.length > Buffer.poolSize) {
      // Big buffer, just alloc one.
      this.parent = new SlowBuffer(this.length);
      this.offset = 0;

    } else {
      // Small buffer.
      if (!pool || pool.length - pool.used < this.length) allocPool();
      this.parent = pool;
      this.offset = pool.used;
      pool.used += this.length;
    }

    // Treat array-ish objects as a byte array.
    if (isArrayIsh(subject)) {
      for (var i = 0; i < this.length; i++) {
        this.parent[i + this.offset] = subject[i];
      }
    } else if (type == 'string') {
      // We are a string
      this.length = this.write(subject, 0, encoding);
    }
  }

  SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length);
} has no method 'concat'
    at /home/proj/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:402:42
/home/proj/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io解析器/lib/index.js:402
返回doneCallback(null,Buffer.concat([sizeBuffer,stringToBuffer(pa
^
TypeError:对象函数缓冲区(主题、编码、偏移){
如果(!(此缓冲区实例)){
返回新缓冲区(主题、编码、偏移量);
}
var类型;
//我们在切片吗?
如果(偏移量的类型=='number'){
this.length=强制(编码);
这个。父母=受试者;
这个偏移量=偏移量;
}否则{
//找出长度
开关(类型=主题类型){
案件编号:
this.length=强制(主题);
打破
大小写“string”:
this.length=Buffer.bytellength(主题,编码);
打破
case'object'://假设对象是数组
this.length=强制(subject.length);
打破
违约:
抛出新错误('第一个参数必须是数字,'+
“数组或字符串”。);
}
if(this.length>Buffer.poolSize){
//大缓冲区,只需分配一个。
this.parent=新慢缓冲区(this.length);
这个偏移量=0;
}否则{
//小缓冲区。
如果(!pool | | pool.length-pool.used

造成这种情况的原因是什么?在本地主机中一切正常。

Buffer.concat仅在节点0.8中受支持。您需要将节点升级到最新版本。Ubuntu 12.04仅提供节点0.6

要升级,可以运行以下命令

$ npm install -g n
$ n stable
这将把最新的节点安装到/usr/local/bin

您可以使用运行节点应用程序

$ /usr/local/bin/node path-to-your-node-app
阅读有关节点二进制文件管理的更多信息,它可以帮助您管理多节点二进制文件安装