Skip to content

Instantly share code, notes, and snippets.

@anshumanb
Last active May 25, 2022 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anshumanb/94cea832ee00e45b0f21a691c83592cb to your computer and use it in GitHub Desktop.
Save anshumanb/94cea832ee00e45b0f21a691c83592cb to your computer and use it in GitHub Desktop.
Call NPM from Node
#!/usr/bin/env node
import { spawnSync } from "child_process";
spawnSync("npm", ["--version"], {
encoding: "utf-8",
shell: true,
stdio: [process.stdin, process.stdout, process.stderr],
cwd: process.cwd(),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment