Combining node.js and three.js on the server side

I'm trying to create a simple application that displays a cube with the .js tag on node.js, for this I tried node-three.js , which basically wraps three.js, creates a simulated browser window and provides a THREE variable so you can use it .
The problem is that I keep getting "TypeError: I can not read the property" x "from undefined", so I narrowed it down to this code:

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

error message:

undefined:818
                this.x = a.x - b.x;
                                ^
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
+4
1

three.js. :
npm install three
:
var THREE = require('three.js');
:
var THREE = require('three');

+4

All Articles