Tsl2561 luminosity node

I can't get the node ( node-red-contrib-tsl2561) for this to install, it has lots of errors, Im trying to use the lux sensor and get a value returned, maybe another way to do it?

Show us the errors when you try to install it from the command line, go to your .node-red folder and run
npm install node-red-contrib-....
And copy/paste the full output here.

2020-07-02T06:55:48.975Z Install : node-red-contrib-tsl2561 0.1.1

2020-07-02T06:55:49.454Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-tsl2561@0.1.1
2020-07-02T06:56:05.244Z [out]
2020-07-02T06:56:05.244Z [out] > tsl2561@0.0.1 install /home/pi/.node-red/node_modules/tsl2561
2020-07-02T06:56:05.244Z [out] > node-gyp rebuild
2020-07-02T06:56:05.244Z [out]
2020-07-02T06:56:09.490Z [out] make: Entering directory '/home/pi/.node-red/node_modules/tsl2561/build'
2020-07-02T06:56:09.490Z [out] CXX(target) Release/obj.target/tsl2561/src/tsl2561.o
2020-07-02T06:56:13.016Z [err] In file included from ../src/tsl2561.cc:2:
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:29:41: error: expected class-name before ‘{’ token
2020-07-02T06:56:13.016Z [err] class Tsl2561 : public node::ObjectWrap {
2020-07-02T06:56:13.016Z [err] ^
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:31:24: error: ‘v8::Handle’ has not been declared
2020-07-02T06:56:13.016Z [err] static void Init(v8::Handlev8::Object exports);
2020-07-02T06:56:13.016Z [err] ^~~~~~
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:31:30: error: expected ‘,’ or ‘...’ before ‘<’ token
2020-07-02T06:56:13.016Z [err] static void Init(v8::Handlev8::Object exports);
2020-07-02T06:56:13.016Z [err] ^
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:37:14: error: ‘Handle’ in namespace ‘v8’ does not name a template type
2020-07-02T06:56:13.016Z [err] static v8::Handlev8::Value New(const v8::Arguments& args);
2020-07-02T06:56:13.016Z [err] ^~~~~~
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:38:14: error: ‘Handle’ in namespace ‘v8’ does not name a template type
2020-07-02T06:56:13.016Z [err] static v8::Handlev8::Value Lux(const v8::Arguments& args);
2020-07-02T06:56:13.016Z [err] ^~~~~~
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.h:39:14: error: ‘Handle’ in namespace ‘v8’ does not name a template type
2020-07-02T06:56:13.016Z [err] static v8::Handlev8::Value Id(const v8::Arguments& args);
2020-07-02T06:56:13.016Z [err] ^~~~~~
2020-07-02T06:56:13.016Z [err] ../src/tsl2561.cc:6:14: error: variable or field ‘InitAll’ declared void
2020-07-02T06:56:13.016Z [err] void InitAll(Handle exports) {
2020-07-02T06:56:13.016Z [err] ^~~~~~
2020-07-02T06:56:13.018Z [err] ../src/tsl2561.cc:6:14: error: ‘Handle’ was not declared in this scope
2020-07-02T06:56:13.026Z [err] ../src/tsl2561.cc:6:14: note: suggested alternative: ‘rand_r’
2020-07-02T06:56:13.026Z [err] void InitAll(Handle exports) {
2020-07-02T06:56:13.026Z [err] ^~~~~~
2020-07-02T06:56:13.026Z [err] rand_r
2020-07-02T06:56:13.027Z [err] ../src/tsl2561.cc:6:27: error: expected primary-expression before ‘>’ token
2020-07-02T06:56:13.027Z [err] void InitAll(Handle exports) {
2020-07-02T06:56:13.027Z [err] ^
2020-07-02T06:56:13.027Z [err] ../src/tsl2561.cc:6:29: error: ‘exports’ was not declared in this scope
2020-07-02T06:56:13.027Z [err] void InitAll(Handle exports) {
2020-07-02T06:56:13.027Z [err] ^~~~~~~
2020-07-02T06:56:13.038Z [err] In file included from ../src/tsl2561.cc:1:
2020-07-02T06:56:13.038Z [err] ../src/tsl2561.cc:10:22: error: ‘InitAll’ was not declared in this scope
2020-07-02T06:56:13.038Z [err] NODE_MODULE(tsl2561, InitAll)
2020-07-02T06:56:13.038Z [err] ^~~~~~~
2020-07-02T06:56:13.038Z [err] /home/pi/.cache/node-gyp/12.18.1/include/node/node.h:608:36: note: in definition of macro ‘NODE_MODULE_X’
2020-07-02T06:56:13.038Z [err] (node::addon_register_func) (regfunc),
2020-07-02T06:56:13.038Z [err] ^~~~~~~
2020-07-02T06:56:13.038Z [err] ../src/tsl2561.cc:10:1: note: in expansion of macro ‘NODE_MODULE’
2020-07-02T06:56:13.038Z [err] NODE_MODULE(tsl2561, InitAll)
2020-07-02T06:56:13.038Z [err] ^~~~~~~~~~~
2020-07-02T06:56:13.520Z [err] make: *** [tsl2561.target.mk:108: Release/obj.target/tsl2561/src/tsl2561.o] Error 1
2020-07-02T06:56:13.521Z [out] make: Leaving directory '/home/pi/.node-red/node_modules/tsl2561/build'
2020-07-02T06:56:13.528Z [err] gyp
2020-07-02T06:56:13.529Z [err]
2020-07-02T06:56:13.530Z [err] ERR! build error
2020-07-02T06:56:13.533Z [err] gyp
2020-07-02T06:56:13.534Z [err] ERR! stack
2020-07-02T06:56:13.534Z [err] Error: make failed with exit code: 2
2020-07-02T06:56:13.534Z [err] gyp ERR!
2020-07-02T06:56:13.535Z [err] stack
2020-07-02T06:56:13.535Z [err] at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2020-07-02T06:56:13.535Z [err] gyp
2020-07-02T06:56:13.535Z [err] ERR! stack
2020-07-02T06:56:13.535Z [err] at ChildProcess.emit (events.js:315:20)
2020-07-02T06:56:13.535Z [err] gyp
2020-07-02T06:56:13.536Z [err] ERR! stack
2020-07-02T06:56:13.536Z [err] at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2020-07-02T06:56:13.537Z [err] gyp
2020-07-02T06:56:13.538Z [err] ERR! System Linux 4.19.118-v7+
2020-07-02T06:56:13.538Z [err] gyp
2020-07-02T06:56:13.538Z [err] ERR!
2020-07-02T06:56:13.539Z [err] command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2020-07-02T06:56:13.539Z [err] gyp ERR!
2020-07-02T06:56:13.539Z [err] cwd /home/pi/.node-red/node_modules/tsl2561
2020-07-02T06:56:13.540Z [err] gyp ERR!
2020-07-02T06:56:13.540Z [err] node -v v12.18.1
2020-07-02T06:56:13.540Z [err] gyp ERR!
2020-07-02T06:56:13.541Z [err] node-gyp -v v5.1.0
2020-07-02T06:56:13.541Z [err] gyp ERR! not ok
2020-07-02T06:56:16.085Z [err] npm WARN node-red-contrib-ui-led@0.3.1 requires a peer of node-red-dashboard@2.14.x but none is installed. You must install peer dependencies yourself.
2020-07-02T06:56:16.085Z [err] npm WARN node-red-project@0.0.1 No repository field.
2020-07-02T06:56:16.085Z [err] npm WARN node-red-project@0.0.1 No license field.
2020-07-02T06:56:16.085Z [err]
2020-07-02T06:56:16.085Z [err] npm ERR! code ELIFECYCLE
2020-07-02T06:56:16.085Z [err] npm ERR! errno 1
2020-07-02T06:56:16.085Z [err] npm ERR! tsl2561@0.0.1 install: node-gyp rebuild
2020-07-02T06:56:16.085Z [err] npm ERR! Exit status 1
2020-07-02T06:56:16.085Z [err] npm ERR!
2020-07-02T06:56:16.085Z [err] npm ERR! Failed at the tsl2561@0.0.1 install script.
2020-07-02T06:56:16.085Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-07-02T06:56:16.085Z [err]
2020-07-02T06:56:16.085Z [err] npm ERR! A complete log of this run can be found in:
2020-07-02T06:56:16.085Z [err] npm ERR! /home/pi/.npm/_logs/2020-07-02T06_56_14_628Z-debug.log
2020-07-02T06:56:16.090Z rc=1

When you see errors with things like error: ‘v8::Handle’ that often means it is an issue with the version of nodejs. I see that you are using 12.x and I also note that the node has not been updated for nearly 5 years. That almost certainly means that it is not compatible with version 12. Unfortunately there is no link to a github repository from the node's page so you cannot take the normal course of adding an issue there.

However the problem itself appears to be in the module used by the contrib node, which is https://github.com/sonnens/node-tsl2561. It has not been updated in 6 years though. You could try submitting an issue against that and see what happens. Otherwise, unless you can fix it yourself, I suspect you will have to find a different solution.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.