grafana / pyroscope-nodejs

Pyroscope NodeJS integration
Apache License 2.0
27 stars 21 forks source link

fix: Apple Silicon Support `Cannot find module /node-v115-darwin-arm64-unknown/pprof.node` #35

Open jjangga0214 opened 11 months ago

jjangga0214 commented 11 months ago

Hi!

It seems N-API binding for Apple Silicon is not to be installed.

Error: Cannot find module '/Users/<user>/<path>/<to>/node_modules/.pnpm/pprof@3.2.1/node_modules/pprof/build/node-v115-darwin-arm64-unknown/pprof.node'

Info

jjangga0214 commented 11 months ago

Reinstalling solved the problem. I think this happened because the package is not prebuilt.
It's to be automatically built after the installation, and if something wrong happens, it fails to create proper .node file.

jjangga0214 commented 10 months ago

This issue happens unconditionally. (So re-opening this issue!) Reinstalling does not solve the issue this time.

jjangga0214 commented 10 months ago

I was working on monorepo by pnpm workspace. I removed every node_modules directories, the one from the root of the monorepo and others each in the leaf packages. And from the root of the monorepo, I pnpm install again. This time it starts to work.

Every time you add a new package that depends on @pyroscope/nodejs into monorepo, you should do this process.

I hope @pyroscope/nodejs depends on prebuilt sub packages, like the way swc does.