node-pcap/node_pcap

NPM install problem

Closed this issue · 9 comments

I'm getting an error whenever I try to use npm to install this. Any suggestions please?

Node v0.10.10
Ubuntu 12.10 (but I have exactly the same error on CentOS 6.2)

chris@chris-desktop:~/Node/Parser$ npm install pcap
npm http GET https://registry.npmjs.org/pcap
npm http 304 https://registry.npmjs.org/pcap
npm http GET https://registry.npmjs.org/socketwatcher
npm http 304 https://registry.npmjs.org/socketwatcher

socketwatcher@0.2.0 install /home/chris/node_modules/pcap/node_modules/socketwatcher
node-gyp rebuild
make: Entering directory /home/chris/node_modules/pcap/node_modules/socketwatcher/build' CXX(target) Release/obj.target/socketwatcher/socket_watcher.o SOLINK_MODULE(target) Release/obj.target/socketwatcher.node SOLINK_MODULE(target) Release/obj.target/socketwatcher.node: Finished COPY Release/socketwatcher.node make: Leaving directory/home/chris/node_modules/pcap/node_modules/socketwatcher/build'
pcap@1.0.0 install /home/chris/node_modules/pcap
node-gyp rebuild
make: Entering directory /home/chris/node_modules/pcap/build' CXX(target) Release/obj.target/pcap_binding/pcap_binding.o CXX(target) Release/obj.target/pcap_binding/pcap_session.o ../pcap_session.cc: In static member function ‘static void PcapSession::PacketReady(u_char*, const pcap_pkthdr*, const u_char*)’: ../pcap_session.cc:72:50: error: ‘memcpy’ was not declared in this scope ../pcap_session.cc: In static member function ‘static v8::Handle<v8::Value> PcapSession::Open(bool, const v8::Arguments&)’: ../pcap_session.cc:202:50: error: ‘strlen’ was not declared in this scope make: *** [Release/obj.target/pcap_binding/pcap_session.o] Error 1 make: Leaving directory/home/chris/node_modules/pcap/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:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.5.0-39-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/chris/node_modules/pcap
gyp ERR! node -v v0.10.10
gyp ERR! node-gyp -v v0.9.6
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

Confirmed, got same problem on Debian 7.
In addtion open_offline fails, error message is "garbage" in errbuf (2 chars). Debugged into c-code - it looks that pcap.open_offline gives handle != NULL back (so this looks fine!) after that it crashes somewhere assuming in Handle.Close(ret). Might be same issue, but other symptoms. I've tested with several node versions and libpcap versions.

I fixed it on my local copy (git clone, changes pcap_session.cc) by putting this two lines in pcap_session.cc
#include // I think this might not be required
#include // memcopy is in this

NPM install works then with "npm install --unsafe-perm".

It did NOT solve the open_offline issue. I might open a new one for it. open_live seems to work after successful installation with the changes above.

Installation works fine on my 10.7.5 Mac.
@seti123: Can you please open a PR incorporating your solution. It would be highly appreciated.

I have the same problem and I'm using Ubuntu 12.04. The error log is exactly as it says in this isuue.

Well, I have the module working but not by npm install. I had to clone the repo and then build the module. Any thoughts of why?

@nomack84: There seems to be some syc problem on the latest repo and the push to npm. Let me check it out.

@nomack84: I'm sorry for the sync error. Got some histories messed up. Please try npm install and let me know if it works or not?

It's working! Thanks for the fast answer.

2013/10/4 Ujjwal Thaakar notifications@github.com

@nomack84 https://github.com/nomack84: I'm sorry for the sync error.
Got some histories messed up. Please try npm install and let me know if it
works or not?


Reply to this email directly or view it on GitHubhttps://github.com//issues/70#issuecomment-25721838
.

i have the same problem, not installing with NPM and i use ubuntu