Maybe is main.ts newline character problem.
When this bin file is executed in a Unix like environment, \n is interpreted as a newline, so this line of code is actually interpreted by the Unix like environment as: #!/usr/bin/env node \r
node\r is treated as a command, so the above error occurs.