Java ProcessBuilder run npm command Not Working

59 Views Asked by At

Using Mac Mini Server

My Java Code 1 :

Process p = Runtime.getRuntime().exec("npm");
p.waitFor();

My Java Code 2 :

Process p = new ProcessBuilder("npm run build")
  directory(new File(path))
  .start();
p.waitFor();

My Java Code 3 :

// npmBuilder.sh => npm run build
Process p = Runtime.getRuntime().exec("bash npmBuilder.sh");
p.waitFor();

Allways same Error :

node:child_process:173
  p.open(fd);
    ^

Error: ENOTTY: inappropriate ioctl for device, uv_pipe_open
    at Object._forkChild (node:child_process:173:5)
    at setupChildProcessIpcChannel (node:internal/process/pre_execution:465:30)
    at prepareMainThreadExecution (node:internal/process/pre_execution:78:3)
    at node:internal/main/run_main_module:10:1 {
  errno: -25,
  code: 'ENOTTY',
  syscall: 'uv_pipe_open'
}

I don't understand what's going on here

0

There are 0 best solutions below