Open Manidavid opened 7 years ago
you're likely getting Error: Cannot find module 'three'
because you haven't installed three
. if you haven't already, please run npm i --save three
Thanks @data-doge . I haven't installed the three node module, after i run npm i --save three
it got installed but when i run the above code it raised the below error,
ReferenceError: XMLHttpRequest is not defined
at FileLoader.load (\web-api\node_modules\three\build\three.js:29860:23) at load (\web-api\node_modules\three-stl-loader\index.js:50:13) at exports.stlmodel_create (\web-api\controllers\stlmodelController.js:10:10)
i found that XMLHttpRequest node moude also missed so i run npm install xmlhttprequest --save
to install and required this module with the below code.
global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var url = 'https://s3.amazonaws.com/minifactory-stl/WALLY_1plate.stl';
var THREE = require('three')
var STLLoader = require('three-stl-loader')(THREE)
var loader = new STLLoader()
loader.load(url, function (geometry) {
console.log(geometry);
var material = new THREE.MeshNormalMaterial()
var mesh = new THREE.Mesh(geometry, material)
scene.add(mesh)
})
It couldn't make the geometry object but got error saying TypeError: Cannot read property 'target' of undefined
, which i could not able to find any solution.
C:\Users\Documents\GitHub\3d-web-api\node_modules\three\build\three.js:2986 5
var response = event.target.response;
^TypeError: Cannot read property 'target' of undefined at .
(\web-api\node_modules\thre e\build\three.js:29865:26) at dispatchEvent ((\web-api\node_modules\xml httprequest\lib\XMLHttpRequest.js:595:29) at setState (\web-api\node_modules\xmlhttpr equest\lib\XMLHttpRequest.js:614:14) at IncomingMessage. (\web-api\no de_modules\xmlhttprequest\lib\XMLHttpRequest.js:447:13) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9)
please note that am trying to access the STL file from the Amazon s3 bucket URL('https://s3.amazonaws.com/minifactory-stl/WALLY_1plate.stl').
Please help me with this issue.
I have installed three-stl-loader node module in my project, trying to process the STL file from amazon s3 url with the below code.
Getting the below error.
Please provide some example code to solve this.