rajeshsola / node-red-addons

Custom nodes for Node-RED
10 stars 17 forks source link

Issue with the new version of socketcan in Node-red #4

Open Bobet21 opened 5 years ago

Bobet21 commented 5 years ago

Hey we have the following issue when trying to install the latest version of Nodered-contrib-canbus as they recently updated the version of node-can

see the following issue Git issue in Node-can

If there is anything simple you could do we would be much grateful :)

Meghadoot commented 5 years ago

Hello, I'm facing the similar issue as @Bobet21 created. I'm using node V11, node-gyp v3 and node-red v0.19 Possible way is to downgrade the node version to get can-bus node from palette. But it's not intended for me to migrate. Please let me know, when proper version will be available (to install on nodered using manage palette)

Here is the snap of terminal:

pi@raspberrypi:~/.node-red $ npm install node-red-contrib-canbus

> socketcan@2.1.3 install /home/pi/.node-red/node_modules/node-red-contrib-canbus/node_modules/socketcan
> node-gyp rebuild

make: Entering directory '/home/pi/.node-red/node_modules/node-red-contrib-canbus/node_modules/socketcan/build'
  CXX(target) Release/obj.target/can/src/rawchannel.o
../src/rawchannel.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RawChannel::New(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/rawchannel.cc:166:45: warning: ‘v8::Local<v8::String> v8::Value::ToString() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10248): Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String ascii(info[0]->ToString());
                                             ^
../src/rawchannel.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RawChannel::AddListener(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/rawchannel.cc:200:50: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
         listener->handle.Reset(info[2]->ToObject());
                                                  ^
../src/rawchannel.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RawChannel::Send(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/rawchannel.cc:260:52: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
     v8::Local<v8::Object> obj =  info[0]->ToObject();
                                                    ^
../src/rawchannel.cc:263:53: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
     frame.can_id = obj->Get(id_symbol)->Uint32Value();
                                                     ^
../src/rawchannel.cc:276:60: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
     frame.can_dlc = node::Buffer::Length(dataArg->ToObject());
                                                            ^
../src/rawchannel.cc:277:61: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
     memcpy(frame.data, node::Buffer::Data(dataArg->ToObject()), frame.can_dlc);
                                                             ^
../src/rawchannel.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RawChannel::SetRxFilters(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/rawchannel.cc:322:53: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
         if (ObjectToFilter(list->Get(idx)->ToObject(), &rfilter[numfilter]))
                                                     ^
../src/rawchannel.cc:332:44: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
       if (ObjectToFilter(info[0]->ToObject(), &rfilter[numfilter]))
                                            ^
../src/rawchannel.cc: In static member function ‘static bool RawChannel::ObjectToFilter(v8::Handle<v8::Object>, can_filter*)’:
../src/rawchannel.cc:414:39: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
     rfilter->can_id = id->Uint32Value();
                                       ^
../src/rawchannel.cc:415:43: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
     rfilter->can_mask = mask->Uint32Value();
                                           ^
../src/rawchannel.cc: In member function ‘void RawChannel::async_receiver_ready(int)’:
../src/rawchannel.cc:486:32: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../../../nan/nan.h:1674) [-Wdeprecated-declarations]
           callback.Call(1, argv);
                                ^
../src/rawchannel.cc:488:60: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../../../nan/nan.h:1652) [-Wdeprecated-declarations]
           callback.Call(Nan::New(listener->handle), 1, argv);
                                                            ^
  SOLINK_MODULE(target) Release/obj.target/can.node
  COPY Release/can.node
  CXX(target) Release/obj.target/can_signals/src/signals.o
../src/signals.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE DecodeSignal(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/signals.cc:103:46: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
     Local<Object> jsData = info[0]->ToObject();
                                              ^
../src/signals.cc:111:35: error: no matching function for call to ‘v8::Value::ToUint32()’
     offset    = info[1]->ToUint32()->Uint32Value();
                                   ^
../src/signals.cc:111:35: note: candidate is:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note: v8::MaybeLocal<v8::Uint32> v8::Value::ToUint32(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note:   candidate expects 1 argument, 0 provided
../src/signals.cc:112:35: error: no matching function for call to ‘v8::Value::ToUint32()’
     bitLength = info[2]->ToUint32()->Uint32Value();
                                   ^
../src/signals.cc:112:35: note: candidate is:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note: v8::MaybeLocal<v8::Uint32> v8::Value::ToUint32(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note:   candidate expects 1 argument, 0 provided
../src/signals.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE EncodeSignal(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/signals.cc:203:46: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/pi/.node-gyp/11.9.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
     Local<Object> jsData = info[0]->ToObject();
                                              ^
../src/signals.cc:212:32: error: no matching function for call to ‘v8::Value::ToUint32()’
     offset = info[1]->ToUint32()->Uint32Value();
                                ^
../src/signals.cc:212:32: note: candidate is:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note: v8::MaybeLocal<v8::Uint32> v8::Value::ToUint32(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note:   candidate expects 1 argument, 0 provided
../src/signals.cc:213:35: error: no matching function for call to ‘v8::Value::ToUint32()’
     bitLength = info[2]->ToUint32()->Uint32Value();
                                   ^
../src/signals.cc:213:35: note: candidate is:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note: v8::MaybeLocal<v8::Uint32> v8::Value::ToUint32(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2529:44: note:   candidate expects 1 argument, 0 provided
../src/signals.cc:218:44: error: no matching function for call to ‘v8::Value::ToNumber()’
         int32_t in_val = info[5]->ToNumber()->Int32Value();
                                            ^
../src/signals.cc:218:44: note: candidates are:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2519:44: note: v8::MaybeLocal<v8::Number> v8::Value::ToNumber(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2519:44: note:   candidate expects 1 argument, 0 provided
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
                 from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2536:31: note: v8::Local<v8::Number> v8::Value::ToNumber(v8::Isolate*) const
                 Local<Number> ToNumber(Isolate* isolate) const);
                               ^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2536:31: note:   candidate expects 1 argument, 0 provided
                 Local<Number> ToNumber(Isolate* isolate) const);
                               ^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../src/signals.cc:228:35: error: no matching function for call to ‘v8::Value::ToNumber()’
     raw_value = info[5]->ToNumber()->Uint32Value();
                                   ^
../src/signals.cc:228:35: note: candidates are:
In file included from /home/pi/.node-gyp/11.9.0/include/node/node.h:63:0,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2519:44: note: v8::MaybeLocal<v8::Number> v8::Value::ToNumber(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
                                            ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2519:44: note:   candidate expects 1 argument, 0 provided
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
                 from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
                 from ../../../../nan/nan.h:53,
                 from ../src/signals.cc:18:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2536:31: note: v8::Local<v8::Number> v8::Value::ToNumber(v8::Isolate*) const
                 Local<Number> ToNumber(Isolate* isolate) const);
                               ^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2536:31: note:   candidate expects 1 argument, 0 provided
                 Local<Number> ToNumber(Isolate* isolate) const);
                               ^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
can_signals.target.mk:99: recipe for target 'Release/obj.target/can_signals/src/signals.o' failed
make: *** [Release/obj.target/can_signals/src/signals.o] Error 1
make: Leaving directory '/home/pi/.node-red/node_modules/node-red-contrib-canbus/node_modules/socketcan/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.9.35-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-canbus/node_modules/socketcan
gyp ERR! node -v v11.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! socketcan@2.1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the socketcan@2.1.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-02-13T01_16_19_121Z-debug.log

Thanks in advance.

Bobet21 commented 5 years ago

As they have brought substantive improvments in the CAN connection process i would NOT consider downgrading as an acceptable option, please le tus know if we could help

d21d3q commented 5 years ago

This seems to be issue with socketcan, so upgrading this library to 2.4.0 should do the job.

Bobet21 commented 5 years ago

@d21d3q are you referring to linux-can/can-utils library ? @Meghadoot did you have a try?

d21d3q commented 5 years ago

No, it is throwing errors in v8.h so it node related.

Meghadoot commented 5 years ago

@Bobet21 sorry for late response. I have already updated socketcan. Issue persists!!

d21d3q commented 5 years ago

go to module installation directory

cd ~/.node-red/node_modules/node-red-contrib-canbus

modify package.json (change version) remove old node_moudles

rm -rf node_modules

and install new dependenties

npm i

It will spit some warnings, but shouldn't crash

Bobet21 commented 5 years ago

I don't even have that package in my repository, shoudl i copy the one from the repository and reapply your mods ?

So i did it, and it works thanks @d21d3q !