wakaru: CLI bug: Error: ENOENT: no such file or directory, open 'out/perf.json' (when using `--perf` alongside `--unpacker-output` / `--unminify-output`)

I got the error:

Error: ENOENT: no such file or directory, open 'out/perf.json'

When running the following command, on this code (Ref):

⇒ CHUNK_NAME="framework"; npx @wakaru/cli all unpacked/_next/static/chunks/${CHUNK_NAME}.js --unpacker-output stage2-unpacked/${CHUNK_NAME} --unminify-output stage3-unminified/${CHUNK_NAME} --perf

┌   Wakaru CLI v0.0.2
│
└  Selected features: Unpacker, Unminify

┌   Unpacker
│
◇  Unpacking...
│
◇  Finished
│
◆  Successfully generated 9 modules (4.51s)
│
└  Output directory: ./stage2-unpacked/framework

┌   Unminify
│
◇  Unminifying... (concurrency: 1)
│
◇  Finished
│
◆  Successfully unminified 9 files (2m21s)
│
└  Output directory: ./stage3-unminified/framework

..snip..

Error: ENOENT: no such file or directory, open 'out/perf.json'
    at Object.openSync (node:fs:592:3)
    at Object.writeFileSync (node:fs:2323:35)
    at Object.writeFileSync (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/jsonfile/index.js:78:13)
    at writePerfStats (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1676:21)
    at nonInteractive (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1653:7)
    at async Object.handler (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1301:5) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'out/perf.json'
}
Full Output
⇒ CHUNK_NAME="framework"; npx @wakaru/cli all unpacked/_next/static/chunks/${CHUNK_NAME}.js --unpacker-output stage2-unpacked/${CHUNK_NAME} --unminify-output stage3-unminified/${CHUNK_NAME} --perf

┌   Wakaru CLI v0.0.2
│
└  Selected features: Unpacker, Unminify

┌   Unpacker
│
◇  Unpacking...
│
◇  Finished
│
◆  Successfully generated 9 modules (4.51s)
│
└  Output directory: ./stage2-unpacked/framework

┌   Unminify
│
◇  Unminifying... (concurrency: 1)
│
◇  Finished
│
◆  Successfully unminified 9 files (2m21s)
│
└  Output directory: ./stage3-unminified/framework


┌─────────┬────────────────────────────┬──────┐
│ (index) │            key             │ time │
├─────────┼────────────────────────────┼──────┤
│    0    │        'prettier-1'        │ 692  │
│    1    │         'prettier'         │ 725  │
│    2    │      'module-mapping'      │ 1971 │
│    3    │     'un-curly-braces'      │ 2702 │
│    4    │         'un-iife'          │ 2805 │
│    5    │  'un-assignment-merging'   │ 2880 │
│    6    │      'un-async-await'      │ 2961 │
│    7    │  'un-sequence-expression'  │ 3047 │
│    8    │       'un-infinity'        │ 3063 │
│    9    │   'un-variable-merging'    │ 3071 │
│   10    │        'un-return'         │ 3112 │
│   11    │        'un-boolean'        │ 3118 │
│   12    │   'un-template-literal'    │ 3153 │
│   13    │       'un-es6-class'       │ 3164 │
│   14    │     'un-esmodule-flag'     │ 3218 │
│   15    │          'un-jsx'          │ 3228 │
│   16    │      'un-use-strict'       │ 3326 │
│   17    │      'un-while-loop'       │ 3394 │
│   18    │       'un-undefined'       │ 3489 │
│   19    │   'un-type-constructor'    │ 3527 │
│   20    │         'un-enum'          │ 3529 │
│   21    │     'un-conditionals'      │ 3532 │
│   22    │  'un-nullish-coalescing'   │ 3645 │
│   23    │     'un-export-rename'     │ 3682 │
│   24    │        'un-typeof'         │ 3689 │
│   25    │   'un-builtin-prototype'   │ 3786 │
│   26    │   'un-bracket-notation'    │ 3889 │
│   27    │    'un-numeric-literal'    │ 3931 │
│   28    │       'smart-rename'       │ 3941 │
│   29    │   'un-optional-chaining'   │ 4200 │
│   30    │     'un-indirect-call'     │ 4226 │
│   31    │          'lebab'           │ 4235 │
│   32    │ 'un-sequence-expression-2' │ 4408 │
│   33    │   'un-flip-comparisons'    │ 4549 │
│   34    │ 'un-sequence-expression-1' │ 4666 │
│   35    │    'un-runtime-helper'     │ 5408 │
│   36    │          'un-esm'          │ 5475 │
│   37    │      'un-parameters'       │ 6522 │
│   38    │       'smart-inline'       │ 7163 │
└─────────┴────────────────────────────┴──────┘
Error: ENOENT: no such file or directory, open 'out/perf.json'
    at Object.openSync (node:fs:592:3)
    at Object.writeFileSync (node:fs:2323:35)
    at Object.writeFileSync (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/jsonfile/index.js:78:13)
    at writePerfStats (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1676:21)
    at nonInteractive (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1653:7)
    at async Object.handler (/Users/devalias/.npm/_npx/adacf4dfcf214674/node_modules/@wakaru/cli/dist/cli.cjs:1301:5) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'out/perf.json'
}

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Now the file should be generated under the overridden folder

Let’s do the “common base” solution first. The worst case would be having cwd as the common base. I will open another feature request for supporting --perf-output

wait, I forgot to modify both interactive and non interactive Interative does not support overriding the path, so no issues.

released

Not yet released 🙏