How to use Node's child process

I’m creating a Meteor Angular app.

I want to import Node’s, child process like this:

var spawn = Npm.require('child_process').spawn;
When I try this, Meteor responds that Npm is not defined. I know this is the old way of using npm packages. What is the current way to use this?

I believe I need to use import but don’t know in what form to do so

I tried import spawn from 'child_process' to no effect.

Use one of the following:

import { spawn } from 'child_process';

or

const spawn = require('child_process').spawn;
1 Like