node.md
This file
Path
docs/node.md
43 lines · 1.1 KiB · Markdown
Last changed by
Improve `readme.md` (#999)ehmickybefore adoptionaca3db3
History of this fileTake it
node.md
🐢 Node.js files
Run Node.js files
import {execaNode, execa} from 'execa';
await execaNode`file.js argument`;
// Is the same as:
await execa({node: true})`file.js argument`;
// Or:
await execa`node file.js argument`;
Node.js CLI flags
await execaNode({nodeOptions: ['--no-warnings']})`file.js argument`;
Node.js version
get-node and the nodePath option can be used to run a specific Node.js version. Alternatively, nvexeca or nve can be used.
import {execaNode} from 'execa';
import getNode from 'get-node';
const {path: nodePath} = await getNode('16.2.0');
await execaNode({nodePath})`file.js argument`;
Next: 🌐 Environment
Previous: 📜 Scripts
Top: Table of contents