combining node.js and three.js on server side
node.js, three.js
Solution
Solved using the original implementation of three.js. first you: `npm install three` and then replace: `var THREE = require('three.js');` with: `var THREE = require('three');`
Problem
I'm trying to make a simple app that renders a cube with three.js on a node.js, for this i have tryed node-three.js which basically wraps three.js, creates a simulated browser window, and exposes THREE variable so you can use it. The problem is that i keep getting "TypeError: Cannot read property 'x' of 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 ``` the error message is: ``` undefined:818 this.x = a.x - b.x; ^ TypeError: Cannot read property 'x' of undefined ``` which (to my understanding) suggests that the second vector can't be identified by THREE module. Anyone who tried this method: were you able to make it work? *In order to make it work under Linux, you should edit the /lib/three.js file: line #10 should be edited: ``` , src = fs.readFileSync(__dirname + '/../deps/three.js/build/three.js') //three.js instead of Three.js ```