Reputation: 199
I have a node.js application with about 10 direct dependencies which result in a total of 50 dependencies.
I would now like to know if any of these dependencies use native code (apart from that of the node.js platform itself of course), such as external system libraries (I've seen libxml used in other projects), own C/C++ libraries, node-gyp build scripts which need compilers installed etc. etc.
Is there an easy/quick way to check the whole dependency tree of a given module for such cases?
Upvotes: 18
Views: 4762
Reputation: 106736
You could simply search for *.node
files, which is the extension used by compiled addons:
find node_modules -type f -name "*.node" 2>/dev/null | grep -v "obj\.target"
If you want to check what shared libraries each addon uses, you could use something like:
find node_modules -type f -name "*.node" 2>/dev/null | grep -v "obj\.target" | xargs ldd
Upvotes: 19
Reputation: 23602
There's a native-modules CLI package for this.
$ npx native-modules
Upvotes: 8