I have installed 0x using `pnpm install -g 0x`. The installed version is 5.7.0. (And I am using node v20.9.0, npx 10.1.0, pnpm 8.6.6) I am trying to profile a typescript file like this `0x -- npx tsx debug.ts`. I can run the script successfully using `npx tsx debug.ts`. When using 0x, I get the following error: ``` ๐ฅ Profilingnpm ERR! code ENOENT npm ERR! syscall open npm ERR! path /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: /home/veith/.npm/_logs/2024-03-12T15_21_50_704Z-debug-0.log Target subprocess error, code: 254 ๐ฅ Process exited, generating flamegraphTypeError [ERR_INVALID_ARG_TYPE]: ๐ซ The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:406:5) at validateString (node:internal/validators:162:11) at join (node:path:1175:7) at /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/index.js:89:27 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async zeroEks (/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/index.js:46:43) at async cmd (/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/cmd.js:98:21) { code: 'ERR_INVALID_ARG_TYPE' } node:internal/errors:497 ErrorCaptureStackTrace(err); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ERR_INVALID_ARG_TYPE') at process.set [as exitCode] (node:internal/bootstrap/node:123:9) at process.exit (node:internal/process/per_thread:188:24) at /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/cmd.js:26:13 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'ERR_INVALID_ARG_TYPE' } ``` The content of the mentioned logfile /home/veith/.npm/_logs/2024-03-12T15_21_50_704Z-debug-0.log is ``` 0 verbose cli /home/veith/.nvm/versions/node/v20.9.0/bin/node /home/veith/.nvm/versions/node/v20.9.0/lib/node_modules/npm/bin/npm-cli.js 1 info using [email protected] 2 info using [email protected] 3 timing npm:load:whichnode Completed in 1ms 4 timing config:load:defaults Completed in 1ms 5 timing config:load:file:/home/veith/.nvm/versions/node/v20.9.0/lib/node_modules/npm/npmrc Completed in 1ms 6 timing config:load:builtin Completed in 1ms 7 timing config:load:cli Completed in 2ms 8 timing config:load:env Completed in 0ms 9 timing config:load:file:/home/veith/projects/automagically/ts/apps/next-automagically/.npmrc Completed in 0ms 10 timing config:load:project Completed in 4ms 11 timing config:load:file:/home/veith/.npmrc Completed in 0ms 12 timing config:load:user Completed in 0ms 13 timing config:load:file:/home/veith/.nvm/versions/node/v20.9.0/etc/npmrc Completed in 0ms 14 timing config:load:global Completed in 0ms 15 timing config:load:setEnvs Completed in 1ms 16 timing config:load Completed in 9ms 17 timing npm:load:configload Completed in 9ms 18 timing config:load:flatten Completed in 2ms 19 timing npm:load:mkdirpcache Completed in 0ms 20 timing npm:load:mkdirplogs Completed in 0ms 21 verbose title npm exec /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/redir-stdout /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/soft-exit tsx debug.ts 22 verbose argv "exec" "--prof" "--logfile" "/home/veith/projects/automagically/ts/apps/next-automagically/debug/%p-v8.log" "--print-opt-source" "-r" "/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster" "-r" "/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/redir-stdout" "-r" "/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/soft-exit" "--" "tsx" "debug.ts" 23 timing npm:load:setTitle Completed in 1ms 24 timing npm:load:display Completed in 0ms 25 verbose logfile logs-max:10 dir:/home/veith/.npm/_logs/2024-03-12T15_21_50_704Z- 26 verbose logfile /home/veith/.npm/_logs/2024-03-12T15_21_50_704Z-debug-0.log 27 timing npm:load:logFile Completed in 6ms 28 timing npm:load:timers Completed in 0ms 29 timing npm:load:configScope Completed in 0ms 30 timing npm:load Completed in 28ms 31 silly logfile start cleaning logs, removing 1 files 32 silly logfile done cleaning log files 33 timing arborist:ctor Completed in 0ms 34 timing command:exec Completed in 6824ms 35 verbose stack Error: ENOENT: no such file or directory, open '/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster/package.json' 36 verbose cwd /home/veith/projects/automagically/ts/apps/next-automagically/debug 37 verbose Linux 6.5.0-25-generic 38 verbose node v20.9.0 39 verbose npm v10.1.0 40 error code ENOENT 41 error syscall open 42 error path /home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster/package.json 43 error errno -2 44 error enoent ENOENT: no such file or directory, open '/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster/package.json' 45 error enoent This is related to npm not being able to find a file. 45 error enoent 46 verbose exit -2 47 timing npm Completed in 6965ms 48 verbose code -2 49 error A complete log of this run can be found in: /home/veith/.npm/_logs/2024-03-12T15_21_50_704Z-debug-0.log ``` What is the problem here? The file it is looking for is indeed not there. There is only `/home/veith/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/0x/lib/preload/no-cluster.js`, with contents ```JS const cluster = require('cluster') cluster.on('fork', () => { throw new Error('0x does not support clustering.') }) ``` I added a console.log in 0x/index.js:89 where the error during logging is thrown to see the args, which seems fine: ```JS { _: [], open: false, o: false, version: false, v: false, help: false, h: false, quiet: false, q: false, silent: false, s: false, treeDebug: false, 'tree-debug': false, kernelTracingDebug: false, 'kernel-tracing-debug': false, kernelTracing: false, 'kernel-tracing': false, collectOnly: false, 'collect-only': false, writeTicks: false, 'write-ticks': false, D: '/tmp/profile-{timestamp}', outputDir: '/tmp/profile-{timestamp}', '--': [ 'tsx', 'debug.ts' ], workingDir: '/home/veith/projects/automagically/ts/apps/next-automagically/debug', status: [Function (anonymous)], argv: [ 'tsx', 'debug.ts' ], pathToNodeBinary: 'npx', name: 'flamegraph', onProcessExit: [Function: noop], collectDelay: 0, title: 'node tsx debug.ts', pid: 197976 } ``` The actual in the logging errors issues seems to be that in index.js:89, this `v8.getIsolateLog(args.workingDir, args.pid)` returns undefined and join can't deal with that. So what causes these 2 issues? Thanks!
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by RunOrVeith and has received 5 comments.