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
Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 1–13why, one step back1<picture>2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 🐢 Node.js files89## Run Node.js files1011```js12import {execaNode, execa} from 'execa';13Improve `readme.md` (#999)ehmickybefore adoptionaca3db3
line 14why, one step back14await execaNode`file.js argument`;Add user guides (#989)ehmickybefore adoptionbe91ecf
line 15why, one step back15// Is the same as:Improve `readme.md` (#999)ehmickybefore adoptionaca3db3
line 16why, one step back16await execa({node: true})`file.js argument`;Add user guides (#989)ehmickybefore adoptionbe91ecf
line 17why, one step back17// Or:Improve `readme.md` (#999)ehmickybefore adoptionaca3db3
line 18why, one step back18await execa`node file.js argument`;Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 19–23why, one step back19```2021## Node.js [CLI flags](https://nodejs.org/api/cli.html#options)2223```jsImprove `readme.md` (#999)ehmickybefore adoptionaca3db3
line 24why, one step back24await execaNode({nodeOptions: ['--no-warnings']})`file.js argument`;Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 25–28why, one step back25```2627## Node.js version28Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 29why, one step back29[`get-node`](https://github.com/ehmicky/get-node) and the [`nodePath`](api.md#optionsnodepath) option can be used to run a specific Node.js version. Alternatively, [`nvexeca`](https://github.com/ehmicky/nvexeca) or [`nve`](https://github.com/ehmicky/nve) can be used.Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 30–35why, one step back3031```js32import {execaNode} from 'execa';33import getNode from 'get-node';3435const {path: nodePath} = await getNode('16.2.0');Improve `readme.md` (#999)ehmickybefore adoptionaca3db3
line 36why, one step back36await execaNode({nodePath})`file.js argument`;Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 37–43why, one step back37```3839<hr>4041[**Next**: 🌐 Environment](environment.md)\42[**Previous**: 📜 Scripts](scripts.md)\43[**Top**: Table of contents](../readme.md#documentation)