node.js - Running a JavaScript program requiring jsfeat -
i have downloaded jsfeat here, , unzipped downloaded file.
inside directory, wrote following:
require("./build/jsfeat.js"); var matrix = new jsfeat.matrix_t(2,2, jsfeat.u8_t | jsfeat.c1_t); matrix.data[1] = 4; console.log(matrix.data[1]);
i ran program follows:
$ node matrix.js
but, got following error:
/users/abc/desktop/javascript/inspirit-jsfeat-59cc928/matrix.js:2 var matrix = new jsfeat.matrix_t(2,2, jsfeat.u8_t | jsfeat.c1_t); ^ referenceerror: jsfeat not defined @ object.<anonymous> (/users/abc/desktop/javascript/inspirit-jsfeat-59cc928/matrix.js:2:19) @ module._compile (module.js:425:26) @ object.module._extensions..js (module.js:432:10) @ module.load (module.js:356:32) @ function.module._load (module.js:311:12) @ function.module.runmain (module.js:457:10) @ startup (node.js:136:18) @ node.js:972:3
why that? how can solve issue?
thanks.
you need assign imported module variable:
var jsfeat = require("./build/jsfeat.js");
if prefer install module npm save downloading manually:
$ npm install jsfeat
the module saved ./node_modules/jsfeat
. can require var jsfeat = require('jsfeat')
.
Comments
Post a Comment