在服务器端结合node.js和three.js

我试图做一个简单的应用程序,呈现在node.js three.js一个多维数据集,为此,我已经tryed 节点three.js基本上包装three.js,创build一个模拟的浏览器窗口,并公开三个variables所以你可以使用它。
问题是,我不断收到“TypeError:无法读取未定义的属性'x'所以我缩小到这个代码:

var THREE = require('three.js'); firstVec = new THREE.Vector3(2,2,2); secondVec = new THREE.Vector3(1,1,1); clonedVec = firstVec.clone(); clonedVec.sub(secondVec); //this line is where the error occurs 

错误信息是:

 undefined:818 this.x = ax - bx; ^ TypeError: Cannot read property 'x' of undefined 

(据我的理解)表明第二个向量不能被THREE模块识别。

任何尝试过这种方法的人都可以做到这一点吗?

*为了使它在Linux下工作,你应该编辑/lib/three.js文件:第10行应该被编辑:

  , src = fs.readFileSync(__dirname + '/../deps/three.js/build/three.js') //three.js instead of Three.js 

使用three.js的原始实现来解决 。 首先你:
npm install three
然后replace:
var THREE = require('three.js');
有:
var THREE = require('three');