Example of node.js app calling native C++ code doing linear algebra with Eigen
You need a recent version of node.js supporting the N-API interface for native modules. You also need node-gyp and Eigen installed.
To install, build and run the code you should roughly do the following:
git clone https://github.com/danm0nster/node-napi-example-eigenvalue.git napi-example
cd napi-example
npm install
node test/test_binding.js
- Node.js can be downloaded from the official site
- Install the node.js native add-on build tool node-gyp with npm:
$ npm install -g node-gyp
- Install Eigen from source or by using package, e.g.
- Mac OS (using brew):
$ brew install eigen
- Linux (Debian | Ubuntu):
$ apt-get install libeigen3-dev
- Mac OS (using brew):