This call results in a path of:
'/private/var/folders/6t/frtzt7q96fv9xjqp3knl3vqh0000gn/T/runs/run_xyz'
The mkdir for run_xyz fails since the parent, /private/var/folders/6t/frtzt7q96fv9xjqp3knl3vqh0000gn/T/runs/, does not exist.
Error
Error: ENOENT: no such file or directory, mkdir '/private/var/folders/6t/frtzt7q96fv9xjqp3knl3vqh0000gn/T/runs/run_xyz'
at Object.mkdirSync (node:fs:1324:3)
Solution
In mkdir, add the {recursive: true} option.
Discussion
Incidentally, fixing this gives an indirect method of https://github.com/sindresorhus/tempy/issues/35, as my intention was similar. To organize my temp files/folders for later cleanup, I was adding a parent folder to my requested temp folder.
Prefix which includes a
path.sep
fails.Repro
This fails as the path will include a
path.sep
:This call results in a path of: '/private/var/folders/6t/frtzt7q96fv9xjqp3knl3vqh0000gn/T/runs/run_xyz'
The mkdir for
run_xyz
fails since the parent,/private/var/folders/6t/frtzt7q96fv9xjqp3knl3vqh0000gn/T/runs/
, does not exist.Error
Solution
In mkdir, add the
{recursive: true}
option.Discussion
Incidentally, fixing this gives an indirect method of https://github.com/sindresorhus/tempy/issues/35, as my intention was similar. To organize my temp files/folders for later cleanup, I was adding a parent folder to my requested temp folder.