Installation error for tfjs-node on raspberry pi 3

Hello,

I’m unable to install tensorflowjs for node on raspberry pi.

When I install tfjs-node, and run it:

Welcome to Node.js v14.16.0.
Type ".help" for more information.
> const tf = require('@tensorflow/tfjs');
undefined
> require('@tensorflow/tfjs-node')
node-pre-gyp info This Node instance does not support builds for Node-API version 8
node-pre-gyp info This Node instance does not support builds for Node-API version 8
Uncaught:
Error: /home/pi/program/nanocptscenariorunner/node_modules/@tensorflow/tfjs-node/lib/napi-v7/tfjs_binding.node: wrong ELF class: ELFCLASS64
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
>

When doing

npm rebuild @tensorflow/tfjs-node 
....
gyp verb node dev dir /home/pi/.cache/node-gyp/14.16.0
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
../binding/tfjs_backend.cc: In function ‘TFE_TensorHandle* tfnodejs::CreateTFE_TensorHandleFromStringArray(napi_env, int64_t*, uint32_t, TF_DataType, napi_value)’:
../binding/tfjs_backend.cc:196:64: error: ‘TF_TString’ was not declared in this scope
                                          array_length * sizeof(TF_TString)));
                                                                ^~~~~~~~~~
../binding/tfjs_backend.cc:198:15: error: ‘t’ was not declared in this scope
....

Nodejs: 14.13
Raspbian lite strech
Raspberry 3 armv7l ==> 32 bits

1 Like

Please update nodejs to 14.17.3 and it will work. Thank you!