chackerian
chackerian

Reputation: 1401

How to use spawn child_process in Meteor

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.

Upvotes: 0

Views: 645

Answers (1)

tomsp
tomsp

Reputation: 1807

for me this works (server/main.js)

import {spawn} from 'child_process';
console.log(spawn); // I20160524-22:04:42.927(2)? [Function]

what's your output? and also this should work

import childProcess from 'child_process';
console.log(childProcess.spawn)

Upvotes: 1

Related Questions