ENOENT Error for file that is there

As the title states, I’m getting an ENOENT error on a binary file that is definitely there. The file is titled main, and it’s permissions are correct. I have tried the following with no luck:

  1. path.join(process.cwd(), ‘/api/main’);

  2. path.join(“.”+process.cwd(), ‘/api/main’);

  3. ‘var/task/api/main’

  4. ‘./api/main’

  5. ‘./main/’

I’ve also tried all the above inside and outside of the api directory and changed the root of the deployment accordingly.

Any help would be appreciated.

Thanks!

Hi, @tapeop!

Someone else in the community had a similar issue, sharing their solution here in case it’s helpful.

1 Like

This didnt seem to work, Here’s the error I’m getting:

shim] error: Error: spawn var/task/api/main ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: ‘ENOENT’,
syscall: ‘spawn var/task/api/main’,
path: ‘var/task/api/main’,
spawnargs:
}
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 108.39 ms Phase: init Status: error Error Type: Runtime.ExitError

It would be helpful if you could provide a minimal reproducible example for us to investigate. Could you do this, @tapeop? Thank you!

Here’s the source code:
https://bitbucket.org/bpxio/hooks-public/src/main/

Here’s the deployment:
https://vercel.com/tape-op/hooks-public/F9FAB9ffvAh4VSpygX3Jwrig5zCm

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.