Fix #2671: act as node only when JS is provided