You are opening a pipe that connects the STDOUT of /usr/bin/js to your SY handle. I'd expect /usr/bin/js to write errors to its STDERR.
Either open a pipe to its STDERR (for instance, by using IPC::Open3, or by first redirecting the STDERR of /usr/bin/js to its STDOUT, using your shells syntax.