I'm trying to integrate a Pyroscope profiling to my node server.
Here is how I use it:
profiler.ts
import Pyroscope from "@pyroscope/nodejs";
Pyroscope.init({
serverAddress: "...",
appName: "app-backend"
});
Pyroscope.start();
index.ts
// ...
import "./profiler.js";
// ...
For TypeScript, I've set compilerOptions.target
and compilerOptions.module
to "esnext" ("type": "module"
in package.json).
When I'm using Node v18 or v19, I get an error when installing the @pyroscope/nodejs
dependency:
error /home/.../node_modules/pprof: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /home/.../node_modules/pprof
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.10
node-pre-gyp info using node@19.9.0 | linux | x64
It installs when using node v16. But then after compiling the TS and starting the node server, I get:
node:internal/process/esm_loader:97
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/.../node_modules/regenerator-runtime/runtime' imported from /home/.../node_modules/@pyroscope/nodejs/dist/esm/index.js
Did you mean to import regenerator-runtime/runtime.js?
I'm on Manjaro if that helps. Does anyone have an idea how to fix this? Thank you.
from Pyroscope triggering error in Node.js (regenerator-runtime)
No comments:
Post a Comment