Node.js Environments
Inline packages
Append :pkg1,pkg2 to install npm packages globally before running:
boks node@18:marked -e "const m = require('marked'); console.log(m.parse('# hello'))"
boks node@20:typescript tsc --versionpackage.json
boks -e @npm:package.json node app.js
boks reads package.json, runs npm install, caches the resulting image, and runs your command.
Auto-detect
boks -e @npm node app.js # finds package.json in CWDUsing yarn instead of npm
@yarn is an explicit alternate package-manager provider for the same
package.json — the symmetry boks preserves is between node and
boks node, so you select yarn as the installer rather than running a
separate boks yarn:
boks -e @yarn:package.json node app.js
boks -e @yarn node app.js # auto-finds package.json, installs with yarn
Unlike @npm, @yarn is never auto-detected from a bare -e . — see
Package managers for why.
Shebang scripts
#!/usr/bin/env -S boks node@18:marked
const { marked } = require('marked');
console.log(marked('# Hello, boks'));chmod +x script.js
./script.jsVersion pinning
boks node@18 --version
boks node@20 --version
boks node@22 --version
Use the LTS tag for the current stable release:
boks node:lts --version