mscdex / cap

A cross-platform binding for performing packet capturing with node.js
MIT License
361 stars 45 forks source link

Installation failed #68

Closed Jostar1024 closed 6 years ago

Jostar1024 commented 6 years ago

Run npm install cap failed. It returns back '../src/binding.cc:4:23: fatal error: pcap/pcap.h: No such file or director'

Verbose output is shown below:

npm info it worked if it ends with ok
npm verb cli [ '/home/xxx/.nvm/versions/node/v8.11.1/bin/node',
npm verb cli   '/home/xxx/.nvm/versions/node/v8.11.1/bin/npm',
npm verb cli   'install',
npm verb cli   'cap',
npm verb cli   '--verbose' ]
npm info using npm@6.1.0
npm info using node@v8.11.1
npm verb npm-session 4107f6b2cbd035d9
npm http fetch GET 200 https://registry.npmjs.org/cap 12ms (from cache)
npm timing stage:loadCurrentTree Completed in 187ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 3ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 24ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 6ms
npm timing stage:loadIdealTree Completed in 34ms
npm timing stage:generateActionsToTake Completed in 6ms
npm verb correctMkdir /home/xxx/.npm/_locks correctMkdir not in flight; initializing
npm timing audit compress Completed in 3ms
npm info audit Submitting payload of 370bytes
npm verb lock using /home/xxx/.npm/_locks/staging-317bcefd62124bc4.lock for /home/xxx/Project/frame-preprocess/node_modules/.staging
npm timing action:extract Completed in 37ms
npm timing action:finalize Completed in 2ms
npm timing action:refresh-package-json Completed in 5ms
npm info lifecycle cap@0.2.0~preinstall: cap@0.2.0
npm timing action:preinstall Completed in 3ms
npm info linkStuff cap@0.2.0
npm timing action:build Completed in 1ms
npm info lifecycle cap@0.2.0~install: cap@0.2.0

> cap@0.2.0 install /home/xxx/Project/frame-preprocess/node_modules/cap
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp verb cli [ '/home/xxx/.nvm/versions/node/v8.11.1/bin/node',
gyp verb cli   '/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.11.1 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.12\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.11.1
gyp verb command install [ '8.11.1' ]
gyp verb install input version string "8.11.1"
gyp verb install installing version: 8.11.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.11.1
gyp verb build dir attempting to create "build" dir: /home/xxx/Project/frame-preprocess/node_modules/cap/build
gyp verb build dir "build" dir needed to be created? /home/xxx/Project/frame-preprocess/node_modules/cap/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /home/xxx/Project/frame-preprocess/node_modules/cap/build/config.gypi
gyp verb config.gypi checking for gypi file: /home/xxx/Project/frame-preprocess/node_modules/cap/config.gypi
gyp verb common.gypi checking for gypi file: /home/xxx/Project/frame-preprocess/node_modules/cap/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/Project/frame-preprocess/node_modules/cap/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/xxx/.node-gyp/8.11.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/xxx/.node-gyp/8.11.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/xxx/.node-gyp/8.11.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/xxx/Project/frame-preprocess/node_modules/cap',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/xxx/.node-gyp/8.11.1
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/xxx/Project/frame-preprocess/node_modules/cap/build'
  g++ '-DNODE_GYP_MODULE_NAME=cap' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/xxx/.node-gyp/8.11.1/include/node -I/home/xxx/.node-gyp/8.11.1/src -I/home/xxx/.node-gyp/8.11.1/deps/uv/include -I/home/xxx/.node-gyp/8.11.1/deps/v8/include -I../../nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/cap/src/binding.o.d.raw   -c -o Release/obj.target/cap/src/binding.o ../src/binding.cc
../src/binding.cc:4:23: fatal error: pcap/pcap.h: No such file or directory
compilation terminated.
cap.target.mk:95: recipe for target 'Release/obj.target/cap/src/binding.o' failed
make: *** [Release/obj.target/cap/src/binding.o] Error 1
make: Leaving directory '/home/xxx/Project/frame-preprocess/node_modules/cap/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-43-generic
gyp ERR! command "/home/xxx/.nvm/versions/node/v8.11.1/bin/node" "/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/xxx/Project/frame-preprocess/node_modules/cap
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm verb lifecycle cap@0.2.0~install: unsafe-perm in lifecycle true
npm verb lifecycle cap@0.2.0~install: PATH: /home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/xxx/Project/frame-preprocess/node_modules/cap/node_modules/.bin:/home/xxx/Project/frame-preprocess/node_modules/.bin:/home/xxx/.nvm/versions/node/v8.11.1/bin:/home/xxx/bin:/home/xxx/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
npm verb lifecycle cap@0.2.0~install: CWD: /home/xxx/Project/frame-preprocess/node_modules/cap
npm info lifecycle cap@0.2.0~install: Failed to exec install script
npm timing action:install Completed in 536ms
npm verb unlock done using /home/xxx/.npm/_locks/staging-317bcefd62124bc4.lock for /home/xxx/Project/frame-preprocess/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 11ms
npm timing stage:runTopLevelLifecycles Completed in 888ms
npm WARN frame-preprocess@0.1.0 No repository field.

npm verb stack Error: cap@0.2.0 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous> (/home/xxx/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:925:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb pkgid cap@0.2.0
npm verb cwd /home/xxx/Project/frame-preprocess
npm verb Linux 4.13.0-43-generic
npm verb argv "/home/xxx/.nvm/versions/node/v8.11.1/bin/node" "/home/xxx/.nvm/versions/node/v8.11.1/bin/npm" "install" "cap" "--verbose"
npm verb node v8.11.1
npm verb npm  v6.1.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cap@0.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cap@0.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing audit submit Completed in 1244ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1245ms
npm timing audit body Completed in 3ms
npm timing npm Completed in 1805ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxx/.npm/_logs/2018-06-06T10_42_56_614Z-debug.log
mscdex commented 6 years ago

As the readme says, you need the libpcap and libpcap-dev/libpcap-devel packages installed on *nix.

Jostar1024 commented 6 years ago

Oh... I didn't see that. Sorry. Now I've installed with success.