Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails #1

Open
jmai444 opened this issue Nov 10, 2016 · 20 comments
Open

Install fails #1

jmai444 opened this issue Nov 10, 2016 · 20 comments

Comments

@jmai444
Copy link

jmai444 commented Nov 10, 2016

I get the following when I install:

root@thingbox:~/userdir # npm install node-red-contrib-pcap
-
> socketwatcher@0.2.1 install /root/userdir/node_modules/node-red-contrib-pcap/node_modules/pcap/node_modules/socketwatcher
> node-gyp rebuild

make: Entering directory '/root/userdir/node_modules/node-red-contrib-pcap/node_modules/pcap/node_modules/socketwatcher/build'
  CXX(target) Release/obj.target/socketwatcher/socket_watcher.o
In file included from ../node_modules/nan/nan_new.h:190:0,
                 from ../node_modules/nan/nan.h:80,
                 from ../socket_watcher.hpp:8,
                 from ../socket_watcher.cpp:5:
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static NanIntern::FactoryBase<v8::Signature>::return_t NanIntern::Factory<v8::Signature>::New(NanIntern::Factory<v8::Signature>::FTH, int, NanIntern::Factory<v8::Signature>::FTH*)’:
../node_modules/nan/nan_implementation_12_inl.h:181:76: error: no matching function for call to ‘v8::Signature::New(v8::Isolate*, NanIntern::Factory<v8::Signature>::FTH&, int&, NanIntern::Factory<v8::Signature>::FTH*&)’
   return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
                                                                            ^
../node_modules/nan/nan_implementation_12_inl.h:181:76: note: candidate is:
In file included from /root/.node-gyp/4.4.7/include/node/node.h:42:0,
                 from ../node_modules/nan/nan.h:24,
                 from ../socket_watcher.hpp:8,
                 from ../socket_watcher.cpp:5:
/root/.node-gyp/4.4.7/include/node/v8.h:4675:27: note: static v8::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)
   static Local<Signature> New(
                           ^
/root/.node-gyp/4.4.7/include/node/v8.h:4675:27: note:   candidate expects 2 arguments, 4 provided
In file included from ../socket_watcher.hpp:8:0,
                 from ../socket_watcher.cpp:5:
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:171:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                         ^
../node_modules/nan/nan.h:166:25: note: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../node_modules/nan/nan.h:564:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:564:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:568:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:568:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:575:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h:575:67: note: candidates are:
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../socket_watcher.hpp:8,
                 from ../socket_watcher.cpp:5:
/root/.node-gyp/4.4.7/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/root/.node-gyp/4.4.7/include/node/node_buffer.h:31:40: note:   no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’
/root/.node-gyp/4.4.7/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/root/.node-gyp/4.4.7/include/node/node_buffer.h:43:40: note:   no known conversion for argument 2 from ‘const char*’ to ‘char*’
In file included from ../socket_watcher.hpp:8:0,
                 from ../socket_watcher.cpp:5:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:579:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), size)’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:586:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
socketwatcher.target.mk:88: recipe for target 'Release/obj.target/socketwatcher/socket_watcher.o' failed
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1
make: Leaving directory '/root/userdir/node_modules/node-red-contrib-pcap/node_modules/pcap/node_modules/socketwatcher/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.13-v7+
gyp ERR! command "/usr/local/bin/node_armv7" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/userdir/node_modules/node-red-contrib-pcap/node_modules/pcap/node_modules/socketwatcher
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm ERR! Linux 4.4.13-v7+
npm ERR! argv "/usr/local/bin/node_armv7" "/usr/local/bin/npm" "install" "node-red-contrib-pcap"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE

npm ERR! socketwatcher@0.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the socketwatcher@0.2.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the socketwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs socketwatcher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/userdir/npm-debug.log

Seems like this issue is reported in node_pcap here:
node-pcap/node_pcap#196

The work around is to install node_pcap from github, but I can't complete the node-red install with the github version.

Thoughts?

Cheers

@jmai444
Copy link
Author

jmai444 commented Nov 11, 2016

A workaround that worked for me is within the node-red directory where user packages are installed:

npm install https://github.com/mranney/node_pcap.git

Then copy the pcap.js and pcap.html files from this repository (node-red-contrib-pcap) into a nodes subdirectory - create the subdirectory if it does not exist

@ram1505
Copy link

ram1505 commented Feb 15, 2017

I'm having ther same issue. After installing npm install https://github.com/mranney/node_pcap.git under the node-red folder, I get a new folder like pi:~/.node-red/node_modules/pcap $. I'm lost after reading your last line for copying pcap.html and pcap.js files. I copied these files to the /.node-red/node_modules/pcap folder and it doesn't work.

@ram1505
Copy link

ram1505 commented Feb 15, 2017

Can I capture probe-requests with this module?

@jmai444
Copy link
Author

jmai444 commented Feb 15, 2017

I see my instruction aren't very clear. The location for the files depends on where node is installed. In my Raspbian install I copied the files to /usr/lib/node_modules/node-red/nodes.

I think it may also work if you create a ~/.node-red/nodes directory and copy the files there.

Yes, I am using this to capture probe requests, but I had other issues to resolve before it worked.

  1. The pcap node drop down list doesn't show interfaces that haven't been assigned an IP address
  2. It will only capture if nodejs is running as root
  3. Figuring out the appropriate settings for the node, particularly the "path"

I don't have time at the moment, but I will try to write up a gist on how I worked around these. It will help me out too, because I'll forget otherwise.

@jmai444
Copy link
Author

jmai444 commented Feb 15, 2017

Quick hints for the above issues:

  1. Install https://github.com/donothingloop/netinterfaces and patch the os.networkInterfaces function in pcap.js according to the readme in the above repo
  2. Use setcap: sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/nodejs, see: http://packetlife.net/blog/2010/mar/19/sniffing-wireshark-non-root-user/
  3. I wanted the message payload coming from pcap to contain the mac address, so I use Path = payload.ieee802_11Frame.shost
    The Output parameter is set to String
    My filter setting is looking for probe requests from particular mac addresses (aa:aa:aa:aa:aa:aa and bb:bb:bb:bb:bb:bb)
    Filter = (wlan addr2 (aa:aa:aa:aa:aa:aa or bb:bb:bb:bb:bb:bb) or wlan addr3 (aa:aa:aa:aa:aa:aa or bb:bb:bb:bb:bb:bb))and type mgt subtype probe-req

I'm having an issue where after about 7-8 days of uptime, it stops capturing packets. The rest of the flow functions, but the pcap node stops outputting anything. Haven't figured out why yet. Likely a kernel or nodejs issue, as when I was using node-red bundle from thethingbox.io on the same hardware this wasn't happening. But thethingbox.io set up had a memory leak after 2-3 weeks uptime that was causing another part of my flow to die.

@ram1505
Copy link

ram1505 commented Feb 16, 2017

Thanks for the detailed steps. Finally I managed to get it work. However, my node-red is crashing like crazy.

@ram1505
Copy link

ram1505 commented Feb 16, 2017

Also, I'm trying to capture prbe-req from nearby devices. I'm using wlan1. In this case for the filter tab, should I just use wlan addr2 and type mgt subtype probe-req?

@ram1505
Copy link

ram1505 commented Feb 16, 2017

I got it working when I modified wlan addr2 and type mgt subtype probe-req to wlan type mgt subtype probe-req

@ram1505
Copy link

ram1505 commented Feb 16, 2017

Got rid of the sudden crashes. I still need to test to see the reliability. Occasionally my node red instance gets restarted. Not sure if it's because of this node.

Do you know how I can also extract the following using this node?

  • Device Manufacturer
  • RSSI signal strength
  • First seen
  • Last seen

@ers4691
Copy link

ers4691 commented Jun 21, 2017

Hi,
I'm also getting the error, but Im unabe to solve it via the workarout.
I installed "npm install https://github.com/mranney/node_pcap.git"
but there is no pcap.html to copy into the node-red-contrib-pcap directory.
@ram1505 How did you solve the issue?

@njh
Copy link
Owner

njh commented Aug 17, 2017

Hi,

For some reason 'Watch' was turned off this repo - so I haven't received any emails about this issue.

I have just merged #2 - which adds support for pcap2. I haven't tested it yet, but there is a good chance it will solve some peoples problems.

nick.

@jmai444
Copy link
Author

jmai444 commented Aug 17, 2017

Thanks!

Great to see this was not abandoned.

I intend to try. I will report back when I do.

Thanks again!

@njh
Copy link
Owner

njh commented Aug 17, 2017

Ok 'pcap2' isn't looking much better for me.

I wonder if I should be going for a completely different approach.

For example, could open pipe to tshark and stream the packets/JSON objects into Node-RED:

sudo tshark -i en0 -T json "arp"

I suspect it would be far less likely to crash.

@jmai444
Copy link
Author

jmai444 commented Aug 18, 2017

With node_pcap installed from the github repo as per my second comment above and now using libcap-dev from Debian Jessie backports, it has been stable for me with 17 days uptime. Problem is you must install node-red-contrib-pcap manually as it won't complete the install process.

Before I upgraded libcap-dev I was having issues with the capture stopping. No crash or errors, just no messages emitted by the pcap node in the flow after 2 or 3 days up time.

@njh
Copy link
Owner

njh commented Aug 18, 2017

I am not sure why installing 'manually' would work or behave differently.
I think a lot of those warnings/errors are related to versions of node.js.

So far I am not sure using pcap2 has made things better.

@jmai444
Copy link
Author

jmai444 commented Aug 18, 2017

The unresolved issue with node_pcap is related to socketwatcher. The workaround is to install via github which doesn't have the problems of the npm package:
npm install https://github.com/mranney/node_pcap.git

But then npm install node-red-contrib-pcap fails with a dependency issue. I'm sure this problem could be addressed in a better way, but I just grabbed pcap.html and pcap.js from your repo here and placed them in the default .node-red/nodes directory. All works then.

Haven't tried pcap2, but it sounds like a different issue. I didn't have crashes - I had problems with the installation of node_pcap and then this package as per the above.

@njh
Copy link
Owner

njh commented Aug 24, 2017

Ah, I see.

So the issue is that node-red-contrib-pcap currently depends on a specific version of node-pcap. I could relax the requirement, so that it depends on a less specific version:

~version "Approximately equivalent to version" See semver
^version "Compatible with version" See semver

https://docs.npmjs.com/files/package.json#dependencies

All of this would be a lot easier if there was a new official release of node-pcap.
pcap2 seems to just be a snapshot of https://github.com/node-pcap/node_pcap

nick.

@jmai444
Copy link
Author

jmai444 commented Aug 24, 2017

Yes, I think that would allow installing over the version of node_pcap that installs via github, which is version 2.0.0. It has been very stable for me since updating to a more recent libcap-dev package. I was having issues with the older version available for Debian Jessie.

I agree that node_pcap seems a bit of a mess at the moment. Lots of outstanding pull requests, plus many forks including one released on npm as pcap2.

@njh
Copy link
Owner

njh commented Sep 5, 2017

I have switched back to node_pcap and changed the version requirement to allow any 2.x.x version.

Hopefully they will release a new, more stable, version of node_pcap to npm soon.

But loosening the version restriction should allow the current GitHub version to be used, if desired.

@raul-parada
Copy link

I cannot install this node correctly, could you tell me how to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants