deno
f2f8666f - feat(cli): provide a `node` on PATH when Node.js is not installed (#34969)

Commit
25 days ago
feat(cli): provide a `node` on PATH when Node.js is not installed (#34969) Some native tools resolve and spawn a `node` child process via a raw OS PATH lookup, which bypasses the `node` interception Deno does at the shell and `child_process` levels. The motivating case is Next.js 16: Turbopack's native addon spawns a pool of `node` workers to run webpack-style JS loaders (PostCSS/Tailwind, `next/font`), so `deno task dev` fails CSS compilation with "spawning node pooled process - No such file or directory" whenever no `node` binary is installed. To make `node` unnecessary, Deno now stands in for it. When the deno binary is invoked through a file named `node` it translates the Node CLI arguments to Deno arguments and runs as if `deno node ...`; and on startup it creates such a `node` executable under DENO_DIR (a symlink on unix, a hardlink or copy on windows) and prepends that directory to its own PATH so child processes, including native NAPI spawns, inherit it. Both are best-effort and only activate when a real `node` is not already on PATH, so existing Node installs are never shadowed; set DENO_DISABLE_NODE_SHIM=1 to turn the behavior off. Reported via denoland/docs#3185.
Author
Parents
Loading