如何在 Meteor 中使用 spawn child_process
How to use spawn child_process in Meteor
我正在创建一个 Meteor Angular 应用。
我想像这样导入 Node 的子进程:
var spawn = Npm.require('child_process').spawn;
当我尝试此操作时,Meteor 响应 Npm 未定义。我知道这是使用 npm 包的旧方法。目前的使用方法是什么?
我认为我需要使用 import 但不知道以什么形式使用
我试过import spawn from 'child_process'
没有效果。
对我来说这很有效 (server/main.js)
import {spawn} from 'child_process';
console.log(spawn); // I20160524-22:04:42.927(2)? [Function]
你的输出是什么?
这也应该有效
import childProcess from 'child_process';
console.log(childProcess.spawn)
我正在创建一个 Meteor Angular 应用。
我想像这样导入 Node 的子进程:
var spawn = Npm.require('child_process').spawn;
当我尝试此操作时,Meteor 响应 Npm 未定义。我知道这是使用 npm 包的旧方法。目前的使用方法是什么?
我认为我需要使用 import 但不知道以什么形式使用
我试过import spawn from 'child_process'
没有效果。
对我来说这很有效 (server/main.js)
import {spawn} from 'child_process';
console.log(spawn); // I20160524-22:04:42.927(2)? [Function]
你的输出是什么? 这也应该有效
import childProcess from 'child_process';
console.log(childProcess.spawn)