Open laurencefass opened 1 year ago
It looks like you're in the wrong directory. What happens when you simply npm install heapdump
? npm should invoke node-gyp automatically, unless you've explicitly turned that off.
i haven't knowingly explicitly turned it off. its only come to my attention now.
installation seems to work ok.
nest-mono % npm i heapdump
added 1 package, and audited 671 packages in 6s
97 packages are looking for funding
run `npm fund` for details
25 moderate severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
but running an app results in an error:
Test suite failed to run
Cannot find module './build/Debug/addon' from 'node_modules/heapdump/index.js'
Require stack:
node_modules/heapdump/index.js
apps/myapp/leaktest/createMemoryLeak1.spec.ts
> 5 | import heapdump from 'heapdump';
running node-gyp configure build from package.json directory results in the OP error.
Ive got node-gyp installed as a global
npm ls -g
/Users/laurence.fass/.nvm/versions/node/v16.20.0/lib
├── @nestjs/cli@9.5.0
├── corepack@0.17.0
├── node-gyp@9.4.0
├── npm@8.19.4
├── npx@10.2.2
└── nx@16.3.2
Can you post the output of find node_modules/heapdump
?
% find node_modules/heapdump
node_modules/heapdump
node_modules/heapdump/LICENSE
node_modules/heapdump/test
node_modules/heapdump/test/test-callback-error.js
node_modules/heapdump/test/test-callback-without-filename.js
node_modules/heapdump/test/test-sigusr2.js
node_modules/heapdump/test/test-callback.js
node_modules/heapdump/binding.gyp
node_modules/heapdump/index.js
node_modules/heapdump/README.md
node_modules/heapdump/package.json
node_modules/heapdump/.clang-format
node_modules/heapdump/build
node_modules/heapdump/build/gyp-mac-tool
node_modules/heapdump/build/Makefile
node_modules/heapdump/build/Release
node_modules/heapdump/build/Release/addon.node
node_modules/heapdump/build/Release/obj.target
node_modules/heapdump/build/Release/obj.target/addon
node_modules/heapdump/build/Release/obj.target/addon/src
node_modules/heapdump/build/Release/obj.target/addon/src/heapdump.o
node_modules/heapdump/build/Release/.deps
node_modules/heapdump/build/Release/.deps/Release
node_modules/heapdump/build/Release/.deps/Release/obj.target
node_modules/heapdump/build/Release/.deps/Release/obj.target/addon
node_modules/heapdump/build/Release/.deps/Release/obj.target/addon/src
node_modules/heapdump/build/Release/.deps/Release/obj.target/addon/src/heapdump.o.d
node_modules/heapdump/build/Release/.deps/Release/addon.node.d
node_modules/heapdump/build/addon.target.mk
node_modules/heapdump/build/config.gypi
node_modules/heapdump/build/binding.Makefile
node_modules/heapdump/build/node_gyp_bins
node_modules/heapdump/build/node_gyp_bins/python3
node_modules/heapdump/src
node_modules/heapdump/src/heapdump-posix.h
node_modules/heapdump/src/heapdump.cc
node_modules/heapdump/src/heapdump-win32.h
Looks healthy. What does file node_modules/heapdump/build/Release/addon.node
print?
I assume you refer to addon.node.d?
cat node_modules/heapdump/build/Release/.deps/Release/addon.node.d
cmd_Release/addon.node := c++ -bundle -undefined dynamic_lookup -Wl,-search_paths_first -mmacosx-version-min=10.13 -arch arm64 -L./Release -stdlib=libc++ -o Release/addon.node Release/obj.target/addon/src/heapdump.o
No, the exact command I posted. uname -a
would be helpful too.
sure, thanks.
nest-mono % file node_modules/heapdump/build/Release/addon.node
node_modules/heapdump/build/Release/addon.node: Mach-O 64-bit bundle arm64
and
nest-mono % uname -a
Darwin rp-2114.racingpost.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64
thank you.
Looks a-okay. I don't know why you're having trouble but heapdump itself seems to be just fine. One final test you can try is check what this prints:
$ node -p 'require("./node_modules/heapdump/build/Release/addon.node")'
Im getting a similar issue on Linux.
make: Entering directory '/home/xyz/data/node_modules/heapdump/build'
CXX(target) Release/obj.target/addon/src/heapdump.o
make: g++: No such file or directory
make: *** [addon.target.mk:113: Release/obj.target/addon/src/heapdump.o] Error 127
make: Leaving directory '/home/xyz/data/node_modules/heapdump/build'
Node v16.19 gyp : 9.4.0
rm -rf node_modules sudo apt-get install build-essential
Problem solved. In case it would help you of someone else...
As of v11.13.0, Node has built-in functionality for taking snapshots:
import { getHeapSnapshot } from "v8";
const stream = getHeapSnapshot(); // returns a readable stream of the heap snapshot
import { writeHeapSnapshot } from "v8";
writeHeapSnapshot(); // writes the heap snapshot to a file
Ive installed the package and the build step is throwing errors:
where do i run the build command? its not specified in the readme.
environment:
aurence.fass@SSG-2510 nest-mono % node -v v16.20.0 laurence.fass@SSG-2510 nest-mono % npm -v 8.19.4
any help or advice appreciated.