Skip to content
Myr

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 file

Take it

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 1–13why, one step back
1<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';13

Improve `readme.md` (#999)ehmickybefore adoptionaca3db3

line 14why, one step back
14await execaNode`file.js argument`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

line 15why, one step back
15// Is the same as:

Improve `readme.md` (#999)ehmickybefore adoptionaca3db3

line 16why, one step back
16await execa({node: true})`file.js argument`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

line 17why, one step back
17// Or:

Improve `readme.md` (#999)ehmickybefore adoptionaca3db3

line 18why, one step back
18await execa`node file.js argument`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 19–23why, one step back
19```
2021## Node.js [CLI flags](https://nodejs.org/api/cli.html#options)2223```js

Improve `readme.md` (#999)ehmickybefore adoptionaca3db3

line 24why, one step back
24await execaNode({nodeOptions: ['--no-warnings']})`file.js argument`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 25–28why, one step back
25```
2627## Node.js version28

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 29why, one step back
29[`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 back
30
31```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 back
36await execaNode({nodePath})`file.js argument`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 37–43why, one step back
37```
3839<hr>4041[**Next**: 🌐 Environment](environment.md)\42[**Previous**: 📜 Scripts](scripts.md)\43[**Top**: Table of contents](../readme.md#documentation)